Bier.Events.Registry (bier v0.1.0)

Copy Markdown View Source

Node-shared pub/sub registry for the realtime events endpoint.

A duplicate-keys Registry (mirroring Bier.Registry's role as shared infrastructure) whose entries are keyed {instance_name, channel}. SSE subscriber processes register themselves; Bier.Events.Listener broadcasts each NOTIFY to the matching entries. Entries die with their process, so there is no unsubscribe bookkeeping.

Summary

Functions

Send {:bier_event, channel, payload} to every subscriber of {instance, channel}; returns the number of subscribers reached.

Subscribe the calling process to channel on instance.

Number of live subscribers for {instance, channel}.

Functions

broadcast(instance, channel, payload)

@spec broadcast(term(), String.t(), String.t()) :: non_neg_integer()

Send {:bier_event, channel, payload} to every subscriber of {instance, channel}; returns the number of subscribers reached.

register(instance, channel)

@spec register(term(), String.t()) :: :ok

Subscribe the calling process to channel on instance.

subscriber_count(instance, channel)

@spec subscriber_count(term(), String.t()) :: non_neg_integer()

Number of live subscribers for {instance, channel}.