Websocket stability with JS client


I’m using Nakama to make authoritative match that handled from back end (GO) and for Front End we are using JavaScript Client library.

All is good but we have an issue with connection stability with the server when we create new socket connection sometimes when we check WS network we get error code 1005 or 1006 then WS connection closed.

We tried {socket.ondisconnect} but it’s not fire an event when WS errors happened and we tried {socket.onerror} the same thing no event fired, so how can we know when connection closed with the server? and how can we re-initiate it with the server? and if re-initiated it will server send broadcast MSGs to the new session?

If I missed any points please let me know.

Thanks in advance,

Hey @ahmad.wshah, apologies for the late reply.

Are you able to reproduce this issue at all? Is it happening over bad networks? Is the server logging anything when this occurs?

The events should fire at the correct times, but I’m trying to narrow down your conditions to see what’s going on.