Room Connection Process
Request connection from client
ZEPETO Multiplay server generates the Client Session and connects to Room
If Room is successfully connected
- share the Room ID and Session ID connected to the client
If the client cannot access the Room
- generate a new Room and connect
The server code should be implemented in World.multiplay package → index.ts file.
Server provides the following Room Lifecycle events:
|Room Lifecycle Event||Description|
|onCreate(options: SandboxOptions)||Called once room has been created. Room initialize logic can be added here.|
|onJoin(client: SandboxPlayer)||Called when the client joined the room.|
The parameter client (SandboxPlayer) contains the client's sessionId identifier.
|onLeave(client: SandboxPlayer, consented?: boolean)||Called when the client left the room.|
The parameter consented is true when the disconnect is requested by the client.
|onTick(deltaTime: number)||Step interval event call on server side, the interval time can be set in SandboxOptions.|
(tickInterval : 100ms)
ZepetoWorldMultiplay component provides an interface for clients to subscribe to GameSession (Room) events from ZEPETO Multiplay server.
List of available events:
|RoomCreated(Room)||Called when a Room is created and accessible. Provides a Room parameter.|
|RoomJoined(Room)||Called when a Room is connected. Provides a Room parameter.|
|RoomLeave(RoomLeaveEvent)||Called when disconnecting from a Room.|
Provides a RoomLeaveEvent parameter.
|RoomReconnected(Room)||Called when the corresponding Room is reconnected. Provides a Room parameter.|
|RoomError(RoomErrorEvent)||Called when an error occurs in the corresponding Room.|
Provides a RoomErrorEvent parameter.
|RoomWeakConnection||Called when the connection is unstable.|