colyseus / colyseus-unity-sdk

⚔ Colyseus Multiplayer SDK for Unity
https://docs.colyseus.io/getting-started/unity-sdk/
MIT License
371 stars 100 forks source link

The remote party closed the WebSocket connection without completing the close handshake #185

Open endel opened 2 years ago

endel commented 2 years ago

Reported by @rakeshparihar on https://github.com/endel/NativeWebSocket/issues/61

Using Reserve seat API to join in a room, and when there is a WebSocket connection drops unexpectedly, its not reconnecting and getting an error " The remote party closed the WebSocket connection without completing the close handshake." with error code : 1006.

Step to reproduce:

Join room by Seat reserve call - (Independent of matchmaking of Colyseus)

  • After successful seat reserve call
  • Ping pong should be started
  • Once get connected try to close the internet for a few seconds or if your internet gets disconnected for some reason.
  • you will get the issue right there
AbhishekFYND commented 2 years ago

Hi Any update on this issue? even we are also facing the same issue

nuruddinwarsi commented 2 years ago

Hi, I am facing the same issue as well. Using an android build to test Steps :

PS: in the server's onLeave method, have added code to allow for reconnection

endel commented 2 years ago

@AbhishekFYND Do you possibly have a small project where we can observe this problem? Do you also use the reconnection feature?

@nuruddinwarsi How does your onLeave() method look like? I've seen some people using .allowReconnection() without the await keyword, thus having unexpected behaviour

nuruddinwarsi commented 2 years ago

@endel

try { if (consented) { throw new Error(Player ${leavingPlayer.id} consented ); } // 10 sec allowed to reconnect await this.allowReconnection(client, GameRules.ReconnectionTime); leavingPlayer.assign({ connected: true, readyState: PlayerReadyState.READY, }); } catch (ex) { // code to remove player from state and declare winner }

I have few concerns regarding my connection flow as well. Server is using typescript / Node and client using Unity / C#

Is there a difference between using client side vs server side joinById method?