系统配置没有开启unipush,但是在进行websocket连接的时候发现系统会默认重置连接到wss://wshzn.gepush.com:5223/nws。导致我的本地websocket无法正常连接,对应的代码如下:
uni.connectSocket({
url: `ws:192.168.1.21:9200`
});
uni.onSocketOpen((res) => {
console.log('WebSocket连接已打开!');
that.socketOpen = true;
});
uni.onSocketError((res) => {
console.log('WebSocket连接打开失败,错误信息为:' + res.errMsg);
that.socketOpen = false;
});
uni.onSocketClose((res) => {
console.log('WebSocket 已关闭!');
that.socketOpen = false;
});