Get socket close reason


I am using single_socket to prevent the user from logging through multiple devices at the same time. It is working as intended but now I also have to implement logic to try to reconnect the socket if it closes due to network issues. For this I need to get the reason for the socket close so that I can check if the socket is closed because of connectivity issue and not because the user logged in from other device but I can’t seem to find any such variable in nakama documentation.

Hello @hamzaRetrocube,

If you’re on a recent enough version of Nakama, the disconnect reason for the single_socket config will be set as the following: nakama/server/session_registry.go at master · heroiclabs/nakama · GitHub.

@gabriel can you please document this where needed?