Socket disconnecting throwing error

Hi! Recently I started getting an error each time my socket disconnects and I am trying to reconnect.
As far as I understand socket.idle_timeout_ms is a flag in the configuration that is responsible for how long the idle connection can live. That is strange because my lives for 30sec, but in the configuration it is set for 60000ms. That’s the first issue.

The other issue is that when I get disconnected after that timeout of 30sec I get an error:

System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.

UPD we tested it on our dev nakama environment with the same config and the same version and the error is not being thrown, also socket doesnt get disconnected at all.
But there is no difference between prod and dev environments

Unity Version: 2021.3.31f1
Nakama SDK: 3.12.0
Nakama Server Version: 3.21.1

Hello @UmarBhatPlaystrom,

The socket.idle_timeout_ms refers to how long an HTTP request is kept alive and is not related to websocket connections, I think what you’re looking for is:



1 Like

Nope, they are the same for both dev and prod nakama instances’ configurations

The only thing I did so far is that I found out that if I explicitly set ISocketAdapter to WebSocketAdapter the exception is not being thrown, but if I set it to WebSocketStdlibAdapter (it is set by default) the exception starts to be throw again. In both cases socket is being disconnected every 30 seconds (In dev version nakama instance socket is never being disconnected itself)

While the issue doesnt persist on dev version of nakama

It’s possible that WebSocketStdlibAdapter isn’t handling ping/pong messages correctly under the hood, if you’re not targeting consoles then there’s no downside in using WebSocketAdapter.

Are these environments on Heroic Cloud? If yes please contact us at with the project names and we’ll have a look.

We use Drone CI. But WebSocketStdlibAdapter is working correct on dev environment. Can you, please, navigate me on where should I look for a problem?

@lugehorsam perhaps you can help here?

Hey @UmarBhatPlaystrom this sounds like an issue specific to your infrastructure setup that we cannot assist with. We recommend Heroic Cloud for running Nakama in production.