wxapp-socket-io icon indicating copy to clipboard operation
wxapp-socket-io copied to clipboard

手动断开连接

Open DarrenHou1993 opened this issue 7 years ago • 2 comments

this.engine.close is not a function. 将源码的 if (this.engine) this.engine.close()改成if (this.engine) this.engine.destroy()之后可以断开连接。但是再次 socket.connect()之后 掉线频率太快。

DarrenHou1993 avatar Mar 02 '17 03:03 DarrenHou1993

disconnect的reason内容是ping timeout

twototoo avatar Mar 08 '18 03:03 twototoo

项目由个pull request,可以解决这个timeout问题 Engine.prototype.destroy = function() {

  • // 销毁的时候关闭socket
  • wx.closeSocket()
  • let sub while (sub = this.subs.shift()) { sub.destroy() }

twototoo avatar Mar 08 '18 03:03 twototoo