【发布时间】:2018-05-10 04:41:08
【问题描述】:
我遵循了一个关于如何制作多人俄罗斯方块游戏的教程,这里是 repo: https://github.com/Leftier/tetris
它在 localhost 上运行得很好,所以我尝试在 heroku 中部署它(https://tetrixtest.herokuapp.com/ --ASD 移动 Q/E 旋转)但我收到以下错误:
WebSocket connection to 'wss://tetrixtest.herokuapp.com/' failed: Error during WebSocket handshake: Unexpected response code: 200
尝试在此行中创建 webSocket(connection-manager.js 第 14 行):
this.conn = new WebSocket(`wss://${window.location.hostname}:${window.location.port}`)
我对 webSockets 了解不多, 起初我认为heroku无法处理websockets,但事实并非如此,所以我尝试直接使用链接作为参数,而不是从浏览器中读取它,但仍然是同样的问题。
我想要一些关于为什么会发生这种情况的线索/提示,我在google和github中搜索过,但我只发现了与socket.io相关的问题
【问题讨论】: