Skip to main content
Version: 2.1.x

Sending data

Waiter

ZilaWS has a unique function called waiter. Waiters (as their name states) can be awaited. They only resolve when the MessageHandler on the client side resolves or returns thus making it perfect to retrieve data from a client. However if the client does not respond in time, waiters will resolve as undefined.

Syntax

waiter<T>(eventHandlerName: string, ...data: any[]): Promise<T | undefined>
const response: string | undefined = await client.waiter("Example name", "myData", true);

Send

You can send data / trigger a MessageHandler by calling the send function. You can send any number of variables with any types.

Syntax

send(eventHandlerName: string, ...data: any[])
client.send("Example name", "myData", true);