国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

連接ws 時報錯 ,麻煩幫看看,提前謝謝了,昨天還執(zhí)行成功了,為什么連初始化都報錯

gaoyongguang

后臺連接是ws://xxxxxxx.cn:8282/

執(zhí)行連接 var ws = new WebSocket('ws://xxxxxx.cn:8282');
ws.onmessage = function (e) {
console.log(e);
}
報錯 Mixed Content: The page at 'https://www.baidu.com/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://xxxxxxx.cn:8282/'. This request has been blocked; this endpoint must be available over WSS.

Uncaught DOMException: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.
at <anonymous>:1:14

后來改成
var ws = new WebSocket('wss://xxxxxxx.cn:8282');
ws.onmessage = function (e) {
console.log(e);
}
這倒好直接報
VM62:1 WebSocket connection to 'wss://xxxxxxxx:8282/' failed:

4487 1 0
1個回答

jackyxie

https頁面不能訪問ws連接。要配置成wss

  • 暫無評論
年代過于久遠(yuǎn),無法發(fā)表回答
??