README.md

# UrbitEx

UrbitEx is an Elixir package to connect to a running Urbit instance.

## Installation
The package is published at Hex, please look at https://hex.pm/packages/urbit_ex.

The package can be installed by adding `urbit_ex` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [
    {:urbit_ex, "~> 0.3.0"}
  ]
end
```

## Use
After adding it to your dependencies, connect to an Urbit ship by running: 
`{:ok, pid} = UrbitEx.start(url, code)`
e.g. `{:ok, pid} = UrbitEx.start("http://localhost", "sampel-sampel-sampel-sampel")`

This will start your Urbit ship as a GenServer and start the EventSource pipeline.
You will need to subscribe to gall apps in order to your Urbit ship to start sending any events. You can do so by running:
UrbitEx.subscribe/2.
To react to events, set up your own logic to react to received events inside the UrbitEx.recv/0 function, and call it.

You can query the GenServer state by running:
`GenServer.call(pid, {:get})`.

For more documentation (still rudimentary), look inside the repo or at https://hexdocs.pm/urbit_ex/0.2.0/UrbitEx.API.html#content.