hub v0.4.1 Hub
Pub-sub hub
Subscription is done with a pattern.
Example:
Hub.subscribe(“global”, %{count: count} when count > 42) Hub.publish(“global”, %{count: 45, message: “You rock!”})
Link to this section Summary
Functions
Publishes the term to all subscribers that matches it Returns the number of subscribers that got the message
Convenience macro for subscribing without the need to unquote the pattern
Subscribes to the quoted pattern in the given channel
Gets a list of all subscribers to a channel
Unsubscribes using the reference returned on subscribe
Link to this section Types
Link to this section Functions
Publishes the term to all subscribers that matches it Returns the number of subscribers that got the message
Convenience macro for subscribing without the need to unquote the pattern.
example:
Hub.subscribe(“global”, %{count: count} when count > 42)
subscribe_quoted(channel(), pattern(), subscribe_options()) :: {:ok, reference()} | {:error, reason :: String.t()}
Subscribes to the quoted pattern in the given channel
example:
Hub.subscribe(“global”, quote do: %{count: count} when count > 42)
Gets a list of all subscribers to a channel
Unsubscribes using the reference returned on subscribe