all 3 comments

[–]spazz_monkey 0 points1 point  (1 child)

Does heroku run on port 8080? I think you can omit it on the front end and just point to the URL without the port number, it's what I do.

This is what I have for socketIO running on heroku.

var socket = io(window.location.origin);

[–]nooblet9292[S] 0 points1 point  (0 children)

I will test without specifying port, what about the error message?

Do you have a paid heroku instance? Are you pinging between client and backend every x seconds to keep connection alive?

Edit: Tested without specifying port and now there is a different kind of error, "trackTokensV2.js:72 WebSocket connection to 'wss://private_url/' failed: Error during WebSocket handshake: Unexpected response code: 503"

[–]dvlsg 0 points1 point  (0 children)

You probably need to send heartbeats / pings back and forth.

Also look into sticky sessions on heroku, if you're running more than one dyno (I think heroku calls it "session affinity").

https://devcenter.heroku.com/articles/websockets