Skip to main content

NotificationEmitter Interface

Interface for a notification emitter that can send typed notification to other clients.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/presence/alpha.

For more information about our API support guarantees, see here.

Signature

/** @sealed */
export interface NotificationEmitter<E extends InternalUtilityTypes.NotificationListeners<E>>

Type Parameters

Parameter Constraint Description
E InternalUtilityTypes.NotificationListeners<E>

Methods

Method Alerts Return Type Description
broadcast(notificationName, args) Alpha void Emits a notification with the specified name and arguments, notifying all clients.
unicast(notificationName, targetClient, args) Alpha void Emits a notification with the specified name and arguments, notifying a single client.

Method Details

broadcast

Emits a notification with the specified name and arguments, notifying all clients.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

broadcast<K extends string & keyof InternalUtilityTypes.NotificationListeners<E>>(notificationName: K, ...args: Parameters<E[K]>): void;
Type Parameters
Parameter Constraint Description
K string & keyof InternalUtilityTypes.NotificationListeners<E>

Parameters

Parameter Type Description
notificationName K the name of the notification to fire
args Parameters<E[K]> the arguments sent with the notification

unicast

Emits a notification with the specified name and arguments, notifying a single client.

This API is provided as an alpha preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

unicast<K extends string & keyof InternalUtilityTypes.NotificationListeners<E>>(notificationName: K, targetClient: ISessionClient, ...args: Parameters<E[K]>): void;
Type Parameters
Parameter Constraint Description
K string & keyof InternalUtilityTypes.NotificationListeners<E>

Parameters

Parameter Type Description
notificationName K the name of the notification to fire
targetClient ISessionClient the single client to notify
args Parameters<E[K]> the arguments sent with the notification