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.

Thank you

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 Client also 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.

  1. Server start and async call ( fetch api )
  2. 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 ? )

  1. After the async command, server send message to client -> client still receive the message even it call leave room already
  2. Server process the leave room command

How to make the leave room immediately and force stop all async call on server.
Thank you

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 ?
console log

I still face this problem. Should I do this

delete room
room = null

After leave() room ?