Connection error 22 when reconnecting


I’m currently writing some code to reconnect the socket after losing connection to the host (currently by switching the wifi connection off and on again), using the Godot 4 client. After getting a closed() callback from the socket, I attempt to call connect_async() on the socket every 5 seconds until it connects again.

However, every reconnection attempt fails with the error “=== Nakama : WARNING === Connection error: 22”

What is error 22, where can I find a list of error messages and their meanings and am I doing anything obviously wrong with how I’m attempting reconnects?

[Edit] Found error in the logs

E 0:00:19:0794 @ connect_to_host(): Condition "wsl_ctx || tcp.is_valid()" is true. Returning: ERR_ALREADY_IN_USE
  <C++ Source>   modules/websocket/wsl_peer.cpp:474 @ connect_to_url()
  <Stack Trace> @ connect_to_host()
        @ connect_async()

I’m still not sure howthe socket is still in use after a disconnect

I solved this by creating a new socket to connect to rather that reconnecting to my existing one