简体   繁体   English

通过WS的WebSocket未连接,但是WSS是

[英]WebSocket via ws not connecting but wss is

I am creating a websocket server using vtortola's websocketserver nugget. 我正在使用vtortola的websocketserver块创建一个websocket服务器。 When I attempt to connect to the server through the external ip using hercules it connects (but obviously fails negotiation), and when I also attempt to connect to it through javascript on a different computer on the same network it connects fine as well, but when I use one of the online websocket echo testers (ie. https://www.websocket.org/echo.html ), it fails to connect at all. 当我尝试使用hercules通过外部ip连接到服务器时,它会连接(但显然协商失败),并且当我也尝试通过javascript在同一网络上的另一台计算机上连接到它时,它的连接也很好,但是当我使用了一个在线websocket回声测试器(即https://www.websocket.org/echo.html ),它根本无法连接。 When analyzing the port on wireshark, the request never even comes through. 分析Wireshark上的端口时,请求甚至从未通过。 Strangly enough, when I change the schema to wss, i can then see the request coming in, although it obviously fails again. 不足为奇的是,当我将模式更改为wss时,我可以看到请求进入,尽管显然它再次失败了。 The appropriate ports are forwarded on my router, and dmz is enabled. 适当的端口在我的路由器上转发,并且启用了dmz。 Does anyone have any idea why this might be happening? 有谁知道为什么会这样?

If the page you are connecting from is HTTPS, you cannot connect to a ws:// websocket. 如果您要连接的页面是HTTPS,则无法连接到ws:// websocket。 The browser does not allow you to downgrade security. 浏览器不允许您降级安全性。

You may be interested in a similar question: html5 Websocket with SSL 您可能对类似的问题感兴趣: 带有SSL的html5 Websocket

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM