微信小程序weapp.socket.io.js连接自动断开报错websocket is closed before the connection is established.

微信小程序weapp.socket.io.js连接自动断开报错websocket is closed before the connection is established,解决办法:

方法一:

1.在socket推送数据格式为普通格式前提下,更换版本,以下连接里面有版本不会报错,https://github.com/weapp-socketio/weapp.socket.io/issues/55

方法二:

推送数据格式如果是 [object ArrayBuffer],则在连接时添加设置,如下


再者,app.js里面监听onshow,onhide处理,如下


参考连接  https://blog.csdn.net/xiaojinglyd/article/details/110733406

参考连接:https://blog.csdn.net/xiaojinglyd/article/details/110733406

你可能感兴趣的:(微信小程序weapp.socket.io.js连接自动断开报错websocket is closed before the connection is established.)