Studio GuideWorld SDK Guide
Log In
World SDK Guide

Multiplay Room

Room Connection Process

👍

Room Connection Process

  1. Request connection from client

  2. ZEPETO Multiplay server generates the Client Session and connects to Room

  3. If Room is successfully connected

    • share the Room ID and Session ID connected to the client
  4. If the client cannot access the Room

    • generate a new Room and connect

Server API

The server code should be implemented in World.multiplay package → index.ts file.

641

Server provides the following Room Lifecycle events:

Room Lifecycle EventDescription
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)

❗️

Caution

  • The OnLeave() event occurs when you press 'Home button > Leave' in the upper left corner during mobile test status.
    • The OnLeave() event does not occur in the Unity editor.

If you're interested in the ZEPETO.Multiplay Server API, refer to the documentation:

📘

Please refer to the following guide. [ZEPETO.Multiplay(Server) API]


Client API

ZepetoWorldMultiplay component provides an interface for clients to subscribe to the World play session (Room) events from ZEPETO Multiplay server.


List of available events:

Room EventListenerDescription
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.
RoomWeakConnectionCalled when the connection is unstable.