
监听WebSocket接受到服务器的消息事件。
CALLBACK返回参数:
| 参数 | 类型 | 说明 |
|---|---|---|
| data | String/ArrayBuffer | 服务器返回的消息 |
示例代码:
wx.connectSocket({
url: 'test.php'
})
wx.onSocketMessage(function (res) {
console.log('收到服务器内容:' + res.data)
})
监听WebSocket接受到服务器的消息事件。
CALLBACK返回参数:
| 参数 | 类型 | 说明 |
|---|---|---|
| data | String/ArrayBuffer | 服务器返回的消息 |
示例代码:
wx.connectSocket({
url: 'test.php'
})
wx.onSocketMessage(function (res) {
console.log('收到服务器内容:' + res.data)
})