Error: session outgoing queue full

In my real-time nakama server game, i send player positions on Update method inside of Unity.
After couple minutes, nakama server broken with this error:
{"level":"error","ts":"zzz","msg":"Failed to route message","uid":"xxx","sid":"xxx","sid":"xxx","error":"session outgoing queue full"
Related source code:
Build: WebGL
Any suggestions? Thanks.

I fixed this problem with FixedUpdate method. (Update call : 186, FixedUpdate: 50)

Hi @halukdemir. This is not a “broken” problem with the server. What it means is that the buffer the server maintains for the client device cannot keep up with the number of messages placed into its outgoing message buffer.

You’re sending too many messages from the server to the game client. There’s only so many messages a game device can receive per second. You should be conscious of this data flow in the design of your game.

H @novabyte
I’m sorry to bother you.
I got this problem today, I’m on the way to reducing the number of messages. However, I have a question to ask: The server always closes the client connection when this problem occurs, how to avoid the connection being closed when “session outgoing queue full”?

session outgoing queue full

Once the outgoing queue reaches its capacity, we choose to close the client connection because it’s the best option we have given the alternatives.

You can adjust the capacity of the queue but it uses more memory and bad actors can fill it to degrade your server performance: Nakama: Configuration | Heroic Labs Documentation

Ultimately the rate at which the buffer fills and drains is a function of messages to send, client connectivity and client CPU (how fast it processes its incoming queue so it can notify the server.) The easiest of those factors for you to adjust is the number of messages that the server must send to begin with.