a year ago
I'm deploying a backend made on Java Spring with railway. Never had any issue on the past year, but I added it websockets features on this last update. When testing and running everything locally it worked perfectly, but after deploying and changing the URL to poiint to the railway deployment, I can't connect at all.
38 Replies
a year ago
what is the exact url you are using
When running locally connecting to:
ws://localhost:8002/ws?token= with the correct token connects perfectly
There is a log on the server that prints when a connection gets established, but the socket never opens at all
a year ago
does your http server and websocket server listen on different ports?
a year ago
what error does the console logs in the browser print?
a year ago
and just to clear up any confusion, this would not be a platform issue
but with the exact same url from the actual client (Made sure by making it print the url+token and pasting it into postman) and the client gets instantly replied with a closed websocket by railway
printing the state goes from "Connecting" to "Closed" but when running locally it goes from "Connecting" to "Opened"
a year ago
we are not closing the connection, this would be an issue with your application's code or configuration, from either your server or client
a year ago
^
a year ago
You would want to add better error handling so that you can see the reason it fails to connect, or the reason your application does not accept the connection
That is what's throwing me off. There are logs for any error message that gets thrown as I could test everything when running locally
locally after a connection I can see the closing reason, status and everything
a year ago
without proper error logging and just general verbose logging it is going to be quite hard to debug the issue with your code
a year ago
have you looked into why your code or configuration could be causing that?
a year ago
we do
a year ago
1.1 and 1.2
welp, the Unity library wasn't compatible with Railway's certificate it seems
So just as for future reference, if anyone is trying to use WebSocketSharp to connect to Railway, it won't work due to WebSocketSharp issues
a year ago
glad you where able to figure out the issue with your code, and thank you for the follow up!

