import { decodeServerNotifications } from '@fishjam-cloud/js-server-sdk';
declare const body: Uint8Array;
declare const handlePeerConnected: (notification: unknown) => void;
// ---cut---
for (const { type, notification } of decodeServerNotifications(body)) {
if (type === 'peerConnected') handlePeerConnected(notification);
}
Decode a raw Fishjam webhook body (
application/x-protobuf) into typed, mapped notifications.A room/stream created with
batchWebhookNotifications: truemay deliver several notifications coalesced into a singleNotificationBatch; 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/trackenums). Non-surfaced variants (handshake, deprecated) are omitted.Accepts a Node
Buffer(aUint8Arraysubclass), aUint8Array, or anArrayBuffer.