Skip to content

Web-Socket Client

The client instance present on:

Note

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.

Properties

id: string

Alias to sessionId.

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.

Note

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

auth: any

Custom data you return during onAuth().

Methods

close(code?: number)

Force disconnection of the client with the server.

Tip

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