How to disconnect from Client
From Client, how to disconnect to server ( not only leave room but close websocket connection ).
I can't find the API to do that.
Hi @boygiandi, what do you mean? Each Room creates a WebSocket connection, by leaving that Room, you're disconnecting that WebSocket.
On previous versions of Colyseus (0.9.x and below) the
Clientalso had a WebSocket connection, this is no longer the case on recent versions. Match-making happens via HTTP requests.
Hope this helps, cheers!
I'm having problem like this.
- Server start and async call ( fetch api )
- When the async call is still in processing, client send command leave room.
( problem is sever wait until async call is finished then process the leave room command - I guest ? )
- After the async command, server send message to client -> client still receive the message even it call leave room already
- Server process the leave room command
How to make the leave room immediately and force stop all async call on server.
As you can see in this console log from client, I removeAllListeners then I leave room. But after that, I still get message from server. How is that possible ?
I still face this problem. Should I do this
delete room room = null
After leave() room ?