Basic socket.io only server won't connect

mrjogoHOBBY

4 months ago

For the life of me I can't get a socket.io Node.js client to connect to a Railway socket.io server. I created a very simple example (https://github.com/mrjogo/socketio-temp that works with localhost) and deployed it as a Railway service with a generated domain. However, when I try to connect the client (`URL=http://socketio-temp-production.up.railway.app npm run client`) nothing happens.

Since this isn't a website / no express.js, it's not a CORS issue. Please let me know if something needs to be configured differently.

Solved

1 Replies

mrjogoHOBBY

4 months ago

Ok, figured it out. When I tried curl "http://socketio-temp-production.up.railway.app/socket.io/?EIO=4&transport=polling" (as recommended at https://socket.io/docs/v4/troubleshooting-connection-issues/#the-server-is-not-reachable) I got a 301 Moved Permanently pointing me to https instead of http, which worked.

I was confused because above the generated domain it says "Access your application over HTTP with the following domains" so I assumed it was http, not https.


Status changed to Solved brody 4 months ago