WeePub v0.1.0 WeePub.Broadcaster View Source

A GenServer that manages distribution of messages to interested clients

Link to this section Summary

Functions

Registers the caller process as a subscriber to broadcasts

Link to this section Functions

Link to this function publish(message, options \\ []) View Source

Publish a message

  • message The message to be sent to subscribers if their filter: matches

Options

  • topic: A narrow cast topic atom. The message will only be evaluated for subscribers registered with a matching topic registration. Note: WeePub.Subscriber does not currently support generating clients with narrow cast topics.
Link to this function subscribe(options \\ []) View Source

Registers the caller process as a subscriber to broadcasts.

Options

  • filter: A function that accepts a single parameter and returns a boolean. Defaults to all messages

  • topic: A narrow cast topic atom. The subscriber’s filter will only be evaluated if the topic matches the topic registered with. Note: WeePub.Subscriber does not currently support generating clients with narrow cast topics.