Create, Compete & Win at Redbrick Connect 2024! 🎉

EventManager

A module that manages server-client events.

In the case of EventManager, there is a difference in API specifications in Client Script and Server Script.

Client-side

Provides guidance on the Event Manager module on the client side.

Methods

.send()

.send(name, params)

Sends a signal with the name corresponding to the name to the server. You can pass the parameters with the params option.

.addListener()

.addListener(name, callback)

Registers the function to run when it receives a signal from the server that corresponds to the name. If the parameters sent by the server exist, receive them and forward them to the callback function.

.removeListener()

.removeListener(name, callback)

If you have a specific function registered for the signal that corresponds to the name, remove it from the list of registered functions.

Server-side

Provides information about the Event Manager module on the server side.

Methods

.send()

.send(clientId, name, params)

Sends a signal with the name corresponding to the name to a client with a specific clientId. You can pass the parameters with the params option.

.sendAll()

.sendAll(name, params)

Sends a signal with the name corresponding to the name to the client. All clients connected to the Room receive a signal. You can pass the parameters with the params option.

.addListener()

.addListener(name, callback)

Registers the function to run when a signal corresponding to the name is received from the client. If the parameters sent by the client exist, receive them and forward them to the callback function.

.removeListener()

.removeListener(name, callback)

If you have a specific function registered for the signal that corresponds to the name, remove it from the list of registered functions.