Function: decodeServerNotifications()
decodeServerNotifications(
data):ServerNotification[]
Defined in: js-server-sdk/src/webhook.ts:31
Decode a raw Fishjam webhook body (application/x-protobuf) into typed,
mapped notifications.
A room/stream created with batchWebhookNotifications: true may deliver
several notifications coalesced into a single NotificationBatch; this helper
transparently unwraps that batch, so a single message and a batch are handled
the same way. Notifications are returned in wire order, with the same payload
mapping the FishjamWSNotifier applies (branded ids, peerType/track
enums). Non-surfaced variants (handshake, deprecated) are omitted.
Accepts a Node Buffer (a Uint8Array subclass), a Uint8Array, or an
ArrayBuffer.
Parameters
| Parameter | Type |
|---|---|
data | ArrayBuffer | Uint8Array<ArrayBufferLike> |
Returns
Example
for (const {type ,notification } ofdecodeServerNotifications (body )) { if (type === 'peerConnected')handlePeerConnected (notification ); }