Express & WebSockets - wss connection failed.
Hi There! I've been trying to solve a problem where my websockets seem to close as soon as I refresh the page. I'm using socket.io and I have made sure I configured CORS correctly to avoid any CORS issues. I encountere the following error with no extra explanation from my developer console as you can see in the picture:
12 Replies
Project ID:
N/A
I'm using the railway domain for my development version as also a custom domain configured with railway. This is my current code snippet for my websocket implementation in the backend.
e06a1209-8d68-4c30-a8dc-bee27085cfa7
Any help would be appreaciated ❤️
please provide a link to where i could get this error for myself, because
failed:
is not helpful unfortunalyI cannot seem to find more information about that error. I'm confused as it does not disclose any extra info.
When you say a link, do you mean a link to my application?
yes, a link to where i could get this error for myself
sent via dm
is the server and client using the same socket.io version?
Yes, I can confirm both and the client are using the same socket.io version
can you make sure the client is only using the websocket transport and that you have an error event listener on both the server and client
yes, let me give it a shot.
I do have error listeners in both the client and the server as also making sure Im using the web socket for transport. I suspect the websocket closes shortly after refreshing for some reason. Is there any way to send a keep alive signal or any other recommendation?
i dont see an error event listener in the code you showed me so far, and im also not seeing any client code that is only making use of the websocket transport
I will keep digging. This one is a weird one. Thanks for the help in the meantime.