Interface BroadcastChannelPubSubOptions<PeerId>

Options for initializing a BroadcastChannelMessageBus

interface BroadcastChannelPubSubOptions {
    channel?: BroadcastChannel;
    defaultTopic?: string;
    keepaliveMs?: number;
    monitorPeers?: number | false;
    now?: (() => number);
    peerId: PeerId;
}

Type Parameters

  • PeerId

Properties

channel?: BroadcastChannel

BroadcastChannel to use.

defaultTopic?: string

Default topic name. Defaults to message.

keepaliveMs?: number

Keepalive message interval in milliseconds. Defaults to DEFAULT_BROADCAST_CHANNEL_MESSAGE_BUS_KEEPALIVE_MS.

monitorPeers?: number | false

Specifies the interval in milliseconds to monitor peers' subscriptions and emit join / leave events. If set to false or <= 0, peers will not be monitored. Defaults to 1000 (1 second).

now?: (() => number)

Type declaration

    • (): number
    • Function to get the current epoch timestamp. Defaults to Date.now.

      Returns number

peerId: PeerId

Peer ID of this instance.

Generated using TypeDoc