[**Documentation**](../../../README)

***

[Documentation](../../../README) / [@zerotal/notifications](../README) / BroadcastChannel

# Class: BroadcastChannel

Defined in: [notifications/src/BroadcastChannel.ts:15](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/notifications/src/BroadcastChannel.ts#L15)

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](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/notifications/src/BroadcastChannel.ts#L16)

#### Parameters

##### notifiable

`Notifiable`

##### notification

[`Notification`](Notification)

#### Returns

`Promise`\<`void`\>

***

### channelFor()

> **channelFor**(`notifiable`): `string`

Defined in: [notifications/src/BroadcastChannel.ts:73](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/notifications/src/BroadcastChannel.ts#L73)

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

#### Parameters

##### notifiable

`Notifiable`

#### Returns

`string`
