Skip to main content
zerotal

Documentation


Documentation / @zerotal/notifications / BroadcastChannel

Class: BroadcastChannel

Defined in: notifications/src/BroadcastChannel.ts:15

Notification channel that pushes a notification to a connected client in real time via @zerotal/broadcasting. Broadcasts on the notifiable's private channel (private-notifications.{id} by default) with the event name "notification"; the payload carries { ...data, id, type, readAt, createdAt }.

Constructors

Constructor

new BroadcastChannel(): BroadcastChannel

Returns

BroadcastChannel

Methods

send()

send(notifiable, notification): Promise<void>

Defined in: notifications/src/BroadcastChannel.ts:16

Parameters

notifiable

Notifiable

notification

Notification

Returns

Promise<void>


channelFor()

channelFor(notifiable): string

Defined in: notifications/src/BroadcastChannel.ts:73

The (prefixed) private channel a notifiable receives broadcast notifications on.

Parameters

notifiable

Notifiable

Returns

string