wss请求被拦截,ios,开发者工具上都可以,但是Android不行
发布于 6 年前 作者 baiqiang 11483 次浏览 来自 问答

在红米note4x上请求被拦截,Provisional headers are shown。

在红米note4上 wss请求都没有,绝望。

希望官方给个解决方案。

代码如下:

testWebSocket() {

let _this = this;

let url = _this.data.wsUri + _this.data.WsToken + “&tid=” + Math.floor(Math.random() * 11);

url = encodeURI(url).replace(/\+/g, ‘%2B’); //将加号转义  成%2B

wx.connectSocket({

url: url,

header: {

‘content-type’: ‘application/json’

},

method: “GET”,

success: function(res) {

console.log(res)

_this.SocketOpen();

_this.closeSocket();

},

fail: function(res) {

console.log(res);

_this.testWebSocket();

}

});

},

1 回复

其他Android手机还没试过,不知道有没有这个问题

回到顶部