代码如下: 使用iOS版微信,调用SocketTask.send方法发送 长度为0的ArrayBuffer,总是收到失败的回调。下拉刷新。
const socket = wx.connectSocket({
url: 'wss://cloud.chivox.com:443/ws?e=0&t=0&version=2',
});
socket.onOpen(() => {
console.log("onOpen");
socket.send({
data: new ArrayBuffer(0),
success: function () {
console.log("success");
},
fail: function () {
console.log("fail");
},
complete: function () {
console.log("complete");
}
})
});
socket.onClose(() => {
console.log("onClose");
});
socket.onError((errMsg) => {
console.log("onError", errMsg);
});
socket.onMessage((data) => {
console.log("onMessage", data);
});
本文网址:http://www.91bianli.com/kaifazhinan/62157.html