连接失败,报错:Failed to connect GoEasy, code:408,error:It is already connected, don’t try again until disconnect() is called.

连接失败,报错:Failed to connect GoEasy, code:408,error:It is already connected, don’t try again until disconnect() is called.

报错原因: 当前客户端已经建立过GoEasy连接了,但是用户还在调用connect尝试建立新的连接 解决方案: 在调用connect前判断一下当前的连接状态,避免一个客户端尝试多次建立goeasy连接。如下代码:

  if (GoEasy.getConnectionStatus() === 'disconnected') {
        this.connectGoEasy(); //连接goeasy
        this.subscribeGroup(); //建立连接后,就应该订阅群聊消息,避免漏掉
   }
Comments are closed.