WebSocket opening handshake timed out
wx.connectSocket({
method: ‘GET’,
url: ‘ws://localhost:1314’,
header: {
‘content-type’: ‘application/json;charset=UTF-8’
}
});
wx.onSocketOpen(function (res) {
console.log(‘WebSocket连接已打开!’)
})
后面的onSocketOpen回调函数 一直无法触发,过几分钟报错
WebSocket connection to ‘ws://localhost:1314/’ failed: WebSocket opening handshake timed out
后台ServerSocket是用java写的,显示已经连接上了。
求解,这个问题怎么解决