steveostudios
steveostudios

Reputation: 23

Sails.js - how do I change what port Socket.io is using

I'm having a bizarre issue. I'm running Sails 0.9.7 and locally everything works great. Deployed on Heroku, everything works great except while I'm at work. At work, the pages work fine, but Sockets is getting 503ed: WebSocket connection to 'ws://gameshowhub.herokuapp.com/socket.io/1/websocket/usGTFi4hOfyza-B4LN8d' failed: Error during WebSocket handshake: Unexpected response code: 503 Everywhere else I go (geographically) the page seems to work, so I think my work network is blocking the Sockets port. Does that sound right? Where can I change the socket's port in Sails - I can't seem to find it anywhere...

Upvotes: 0

Views: 2217

Answers (1)

HaNdTriX
HaNdTriX

Reputation: 29756

sails sockets will use the default port: sails.config.port this will be 1337 if you didn't change it.

Heroku doesn't support websockets out of the box. You'll need to enable them via:

heroku labs:enable websockets

More info at devcenter.heroku.com/articles/node-websockets.

If websockets will get blocked via firewall they should switch to

htmlfile
xhr-polling
jsonp-polling

you may also enable flashsockets in the config/sockets.js-file.

Upvotes: 2

Related Questions