Are you using socket.io

I noticed Meteor’s Sockjs server is at /sockjs of the port the app is currently running from . I have my socket.io server running well but it has to be on another port. Is there a way I can make it run like sockjs on ‘localhost:3000/socket.io’ on the app’s port instead of localhost:DIFFERENTPORT/socket.io.

Just wondering . thoughts?

Use DDP_DEFAULT_CONNECTION_URL env.var to point WebSocket connection to a different address.

Like:

DDP_DEFAULT_CONNECTION_URL='https://example.com:3333' meteor

Note: ROOT_URL env.var probably should be set too and point to the main address with app’s bundle

1 Like

I don’t quite understand .so how do I set Sokect Io url for example

It depends from how you run (e.g. start) your app, is it dev or prod stage?

Dev shell (terminal) example:

DDP_DEFAULT_CONNECTION_URL='https://example.com:3333' meteor
1 Like