Bourse.WS.Broadcast (bourse v0.1.0)

Copy Markdown View Source

Registry-backed fan-out for routed WS adapter messages.

Summary

Functions

Dispatches a message to all subscribers of a topic.

Child spec for the duplicate-key Registry.

Registers the calling process for a topic.

Builds a broadcast topic from exchange id, family, and optional channel.

Unregisters the calling process from a topic.

Types

topic()

@type topic() :: {String.t(), atom(), String.t() | nil}

Functions

broadcast(topic, message)

@spec broadcast(topic(), term()) :: :ok

Dispatches a message to all subscribers of a topic.

child_spec()

@spec child_spec() :: Supervisor.child_spec()

Child spec for the duplicate-key Registry.

subscribe(topic)

@spec subscribe(topic()) :: :ok

Registers the calling process for a topic.

topic(exchange_id, family, channel \\ nil)

@spec topic(String.t(), atom(), String.t() | nil) :: topic()

Builds a broadcast topic from exchange id, family, and optional channel.

unsubscribe(topic)

@spec unsubscribe(topic()) :: :ok

Unregisters the calling process from a topic.