UrbitEx.Channel (UrbitEx v0.6.6) View Source

GenServer module to open Eyre channels. Defines an UrbitEx.Channel struct to keep track of the channel state. Elixir processes can subscribe to channels to consume the events their propagate, either raw Eyre events or Eyre events parsed by UrbitEx.Reducer

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Subscribes to a channel in order to receive the SSE events (after parsing by the UrbitEx default reducer) it publishes. Takes a pid or atom name of the channel to subscribe to, and the pid of the subscriber process.

Subscribes to a raw Eyre SSE pipeline in order to receive the raw SSE events it publishes. Takes a pid or atom name of the channel to subscribe to, and the pid of the subscriber process.

Fetches Channel state. Takes a pid or atom name of the channel to fetch. Returns a Channel struct, to be used in UrbitEx functions involving PUT requests.

Deletes the subscription to a channel. No events will be received after calling this function. Takes a pid or atom name of the channel to subscribe from, and the pid of the subscriber process.

Deletes the subscription to raw events. Takes a pid or atom name of the channel to unsubscribe from, and the pid of the subscriber process.

Link to this section Functions

Link to this function

add_event(pid \\ :main, event)

View Source

Specs

add_event(atom() | pid() | {atom(), any()} | {:via, atom(), any()}, any()) ::
  :ok

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

consume_feed(channel_pid, consoomer_pid)

View Source

Subscribes to a channel in order to receive the SSE events (after parsing by the UrbitEx default reducer) it publishes. Takes a pid or atom name of the channel to subscribe to, and the pid of the subscriber process.

Link to this function

consume_raw(channel_pid, consoomer_pid)

View Source

Subscribes to a raw Eyre SSE pipeline in order to receive the raw SSE events it publishes. Takes a pid or atom name of the channel to subscribe to, and the pid of the subscriber process.

Fetches Channel state. Takes a pid or atom name of the channel to fetch. Returns a Channel struct, to be used in UrbitEx functions involving PUT requests.

Link to this function

save_ack(pid \\ :main, id)

View Source
Link to this function

save_action(pid \\ :main, id)

View Source
Link to this function

save_subscription(pid \\ :main, subscription)

View Source
Link to this function

start(options \\ [], name \\ :main)

View Source
Link to this function

start_link(options \\ [], name \\ :main)

View Source
Link to this function

wean(channel_pid, consoomer_pid)

View Source

Deletes the subscription to a channel. No events will be received after calling this function. Takes a pid or atom name of the channel to subscribe from, and the pid of the subscriber process.

Link to this function

wean_raw(channel_pid, consoomer_pid)

View Source

Deletes the subscription to raw events. Takes a pid or atom name of the channel to unsubscribe from, and the pid of the subscriber process.