UrbitEx (UrbitEx v0.3.5) View Source

Main API for the UrbitEx Package. Initializes the Urbit ship, logs in, opens an Eyre channel and starts an Server-side event pipeline. Start the connection with UrbitEx.start/2 Subscribe to event streams with UrbitEx.subscribe. Once subscribed, Urbit server-side events will be sent as messages from the GenServer process to the current process. Set up your own logic to respond to events sent from Urbit inside UrbitEx.recv().

Link to this section Summary

Functions

Starts a recursive loop that reacts to events received from your Urbit ship. Takes a single argument, a function that will process received messages. ## Examples

Starts the Urbit instance.

Subscribes to event streams. Takes the pid of the connection (returned by UrbitExstart()), and a list of subscriptions. If it's a single subscription you want just wrap it in a list.

Function provided for testing purposes. It will subscribe to the same event streams as the Landscape client does. Takes a url and +code. Returns the pid of the GenServer started. Check the state with check_state(pid) and you can browse all events received, etc.

Link to this section Functions

Starts a recursive loop that reacts to events received from your Urbit ship. Takes a single argument, a function that will process received messages. ## Examples

 ```
 function = fn
   %{"json" => json} -> IO.inspect(json)
   _message -> IO.inspect(:other_app)
 end
 UrbitEx.recv(function)

Starts the Urbit instance.

Examples

iex> {:ok, pid} = UrbitEx.start("http://localhost:8080", "sampel-dozzod-mirtyl-marzod")
Link to this function

subscribe(pid, subscriptions)

View Source

Subscribes to event streams. Takes the pid of the connection (returned by UrbitExstart()), and a list of subscriptions. If it's a single subscription you want just wrap it in a list.

Function provided for testing purposes. It will subscribe to the same event streams as the Landscape client does. Takes a url and +code. Returns the pid of the GenServer started. Check the state with check_state(pid) and you can browse all events received, etc.