Multiplay Room Message

ZEPETO Multiplay provides an interface for sending/receiving messages between clients and servers (Room). The server can send messages exclusively to individual clients or globally to all connected clients.
The delivery message types supports Primitive, Schema, Custom(Object) types.
The Server API provides the following Method.
API | Description |
---|---|
onMessage(Type, Callback) | The ZEPETO Multiplay server can register callbacks mapped them by type to handle messages sent by clients. The type parameter can be defined as a string. |
client.send(Type, Message) | Function for sending messages to a specific client. |
broadcast(Type, Message) | Function for sending messages to all clients connected to the room. You can send it to all connected clients, or you can additionally exclude specific clients from the list. |
If you're interested in the ZEPETO.Multiplay Server API, refer to the documentation:
📘 Please refer to the following guide. [ZEPETO.Multiplay(Server) API]

The following is an example of using onMessage.

The following is an example of using client.send.

The following is an example of using broadcast.

â–¼ Example of broadcasting a message to all clients

â–¼ Example of broadcasting a message with excluding specific clients

The Client API provides the following Method.
room.AddMessageHandler(Type, Message) | Messages received from the server can be received by registering an AddMessageHandler callback. You can define the message type you want to receive when registering a message callback. |
---|---|
room.Send(Type, message) | Interface used to forward messages to the server. You can define the message type to forward. |
Receive a message The following is an example of using room.AddMessageHandler.

Send Message The following is an example of using room.Send.

Check out examples of various types of Room Message.
Server
Client