Sake.Plug.Streams (Sake v0.1.0)

Copy Markdown View Source

The registry of open streams on this node: subscriptions/listen streams, legacy GET streams, and handlers waiting for a legacy elicitation answer. Started by the Sake supervisor. With a pubsub: option (a Phoenix.PubSub name) notifications reach every node.

Summary

Functions

Sends {:sake_notify, event} to the streams of server on every node.

Routes a legacy client's JSON-RPC response to the handler waiting for it.

Registers the calling process as waiting for the client's answer to request id.

Registers the calling process as a legacy GET stream for the session (by its nonce).

Registers the calling process as a modern listen stream.

Functions

broadcast(server, event)

@spec broadcast(module(), {:list_changed, atom()} | {:resource_updated, String.t()}) ::
  :ok

Sends {:sake_notify, event} to the streams of server on every node.

child_spec(opts)

deliver_response(id, response)

@spec deliver_response(term(), {:ok, map()} | {:error, map()}) :: :ok | :error

Routes a legacy client's JSON-RPC response to the handler waiting for it.

register_elicit(id)

Registers the calling process as waiting for the client's answer to request id.

register_legacy(server, session_nonce)

Registers the calling process as a legacy GET stream for the session (by its nonce).

register_listen(server, subscription_id, filter)

Registers the calling process as a modern listen stream.