Skip to main content

Class: NotificationUtils

Defined in: service-core/src/NotificationUtils.ts:15

Utility functions for sending push notifications to registered clients.

Constructors​

Constructor​

new NotificationUtils(redis): NotificationUtils

Defined in: service-core/src/NotificationUtils.ts:27

Initializes the utility using the given redis connection.

Parameters​

redis​

RedisClientType

The redis connection to publish to.

Returns​

NotificationUtils

Methods​

sendMessage()​

sendMessage(uids, type, action, data): void

Defined in: service-core/src/NotificationUtils.ts:40

Sends a given message to the room or user with the specified uid(s). Publishing is fire-and-forget: a broadcast failure will never propagate back into whatever write triggered the notification.

Parameters​

uids​

string | string[]

The universally unique identifier of the room or user to send the message to.

type​

string

The type of message being sent.

action​

string

The action performed on the data (if applicable).

data​

any

The contents of the message to send to the room or user.

Returns​

void