Igo*_*gor 6 heroku websocket node.js socket.io
我的应用程序在localhost中正常工作,socket.io使用websockets和xhr-polling,它在heroku中使用xhr-polling,但由于heroku提供了对websocket的支持,我无法使用websockets进行工作.
我的Chrome控制台会显示以下消息:
WebSocket connection to 'ws://<myherokuapp>.herokuapp.com/socket.io/1/websocket/HBWE2BFvHahlSWk5ppHP' failed: Unexpected response code: 503
Run Code Online (Sandbox Code Playgroud)
我已经启用了websocket实验室.
有没有使用socket.io的websocket的工作示例?
Amp*_*mpT 17
我有同样的问题,只是通过重新激活我在heroku 上的应用程序上的websockets来修复它.由于某种原因,它只是随机切换到XHR轮询.
我在heroku的网站(@ https://devcenter.heroku.com/articles/heroku-labs-websockets)中使用此命令重新激活它:
heroku labs:enable websockets -a myapp
然后我通过推送到heroku并重建(或使用:)来重新启动我的服务器heroku restart.
我还有一个非常基本的socket.io聊天应用程序(由Smitha Milli编写)的工作副本,运行于:http://calm-gorge-8474.herokuapp.com/,您可以测试.
希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
6333 次 |
| 最近记录: |