Reputation: 4690
I am making a multiplayer game using Socket.io, Node.js, and Openshift. It was working for a while, but I made a few small changes and now something unrelated to what I changed has broken. When a second player tries to join the game, it boots everyone out, showing a 503 error for anyone else who goes on the site. For the second player, I get a lot of console errors including
WebSocket connection to 'ws://avalon-evao.rhcloud.com/socket.io/?EIO=3&transport=websocket&sid=d5smykffy4EWHxgIAAAC' failed: Error during WebSocket handshake: Unexpected response code: 400
http://avalon-evao.rhcloud.com/socket.io/?EIO=3&transport=polling&t=1421020862973-4&sid=d5smykffy4EWHxgIAAAC Failed to load resource: the server responded with a status of 502 (Bad Gateway)
http://avalon-evao.rhcloud.com/socket.io/?EIO=3&transport=polling&t=1421020865831-6&sid=d5smykffy4EWHxgIAAAC Failed to load resource: the server responded with a status of 503 (Service Unavailable)
socket.io-1.2.0.js:2 WebSocket connection to 'ws://avalon-evao.rhcloud.com/socket.io/?EIO=3&transport=websocket&sid=c-fwcJaMkp_9rl5CAAAA' failed: WebSocket is closed before the connection is established.
It works perfectly fine in localhost, but the real site is broken.
Here's what I've tried:
rhc app restart
rhc app force-stop rhc app start
{ secure: true }
optionWhat is causing these errors and how can I fix them?
Upvotes: 2
Views: 5554
Reputation: 4690
It turns out I was looking at the logs wrong. When I figured out how to read the logs for rhc, I found an error in the database. I had changed the structure of the collections without dropping the database, so there were indexes to keys that no longer existed. Dropped the database, and the app works fine now.
Upvotes: -1
Reputation: 177
Try:
ws://...rhcloud.com:8000/socket.io/...
wss://...rhcloud.com:8443/socket.io/...
Upvotes: 1