[英]Browser not connecting to server with websocket
I am hosting my app with Heroku and using websockets. 我正在用Heroku托管我的应用程序并使用websockets。 When the browser sends a request the connection fails due to this error message:
当浏览器发送请求时,由于以下错误消息,连接失败:
Firefox can't establish a connection to the server at wss://shrouded-dawn-5557.herokuapp.com/ws Firefox无法在wss://shrouded-dawn-5557.herokuapp.com/ws与服务器建立连接
In my javascript file I create a new websocket object as: 在我的javascript文件中,我创建了一个新的websocket对象,如下所示:
ws = new WebSocket("ws://"+ location.host +"/ws");
Why is this not making the connection to the server. 为什么这没有建立与服务器的连接。
Thanks 谢谢
通过在Heroku中启用websocket解决了此问题:
heroku labs:enable websockets -a myapp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.