I am facing an issue with my backend app on Nest.js and Socket.io after deploying on Heroku (on localhost all works), then I try to set a custom port for WebSockets from @WebSocketGateway() decorator.
When I set empty decorator like that, all is working:
But when I set this decorator with some params (like port), and I can't connect to my ws endpoint.
Did someone face a similar problem?
I created codesandbox with this code - https://codesandbox.io/s/nest-socket-io-custom-options-forked-vgx238
Heroku doesn't expose every port, just the port assigned to the PORT
env variable which is what your application should be running on. There's no way to use a custom port other than the given process.env.PORT