Skip to content

Web-Socket Client

The client instance present on:


This is the raw WebSocket connection coming from the ws package. There are more methods available which aren't encouraged to use along with Colyseus.


id: string

Unique id per client. When the same client connects with multiple browser tabs, the id will be the same for every connection.

sessionId: string

Unique id per session. Whilst you may have the same id for multiple sessions from the same client, the sessionId is always unique.


In the client-side, you can find the sessionId in the room instance.


close(code?: number)

Force disconnection of the client with the server.


This will trigger room.onLeave event on the client-side.