Error during WebSocket handshake: Unexpected response code: 301 或 302

如果服务端没有使用SSL,使用WebSocket

1
websocket = new WebSocket("ws://域名/path");

如果服务端使用SSL,使用WebSocket

1
websocket = new WebSocket("wss://域名/path");

可以理解wss高级了一些,否则会报错误

1
Error during WebSocket handshake: Unexpected response code: 301


1
Error during WebSocket handshake: Unexpected response code: 302

坚持原创技术分享,您的支持将鼓励我继续创作!
0%