ubuntu Uncaught DOMException: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.

jim

问题

前端这边连接的时候 直接连上不上去
报错信息

(index):86 Uncaught DOMException: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
at HTMLDivElement.<anonymous> (http://doc.yysaa.cn/:86:16)
at HTMLDivElement.dispatch (http://doc.yysaa.cn/jquery.min.js:3:8436)
at HTMLDivElement.r.handle (http://doc.yysaa.cn/jquery.min.js:3:5139)
(anonymous) @ (index):86
dispatch @ jquery.min.js:3
r.handle @ jquery.min.js:3
(index):30 WebSocket connection to 'ws://203.19xx.xxx.xx:8000/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
(anonymous) @ (index):30

截图

服务器脚本运行

截图

后端代码

截图

6450 1 0
1个回答

MarkGo

onerror->onclose
链接没建立起来,使用send报错。
你可以尝试把websocket监控改为0.0.0.0,而非127.0.0.1
另外我印象中,chrome好像不支持ws链接了吧,必须使用wss进行(我不确定)

  • jim 2021-02-01

    感谢,已解决。chrome 我这边ws 还是支持的

年代过于久远,无法发表回答
🔝