So far, developers have typically used JSON to interact with Urbit ships through Eyre's HTTP interface. As of kernel version
[%zuse 413], however, Eyre also supports sending and received nouns directly. At this stage, there are limited options for dealing with nouns in other languages, so this guide will only cover the channel mechanics on a low-level. You may, however, be interested in the
@urbit/nockjs package and the work-in-progress
json-bgon PR for
If you are not familiar with low-level Eyre channel mechanics, please have a read through the Eyre guide first.
Eyre will create a noun channel if a
PUT request to open a new channel includes the following HTTP header:
...and the body contains the
++jam of a
@uw base64 encoding.
channel-request is defined in
:: channel-request: an action requested on a channel::+$ channel-request$% :: %ack: acknowledges that the client has received events up to :id::[%ack event-id=@ud]:: %poke: pokes an application, validating :noun against :mark::[%poke request-id=@ud ship=@p app=term mark=@tas =noun]:: %poke-json: pokes an application, translating :json to :mark::[%poke-json request-id=@ud ship=@p app=term mark=@tas =json]:: %watch: subscribes to an application path::[%subscribe request-id=@ud ship=@p app=term =path]:: %leave: unsubscribes from an application path::[%unsubscribe request-id=@ud subscription-id=@ud]:: %delete: kills a channel::[%delete ~]==
So, given the following (trivial)
...it is jammed to the following HEX:
...then encoded in the following
@uw-style base64 string in the request body:
If the body of the request is not correctly encoded as described above, it will fail with a
If successful, you can then make a
GET request to open an event stream for the newly created channel. The
GET request must include the following header:
GET request is for an existing channel which is not already in noun mode, it will fail with a
406 status code. You cannot change the channel mode once the channel has been established. If the header is missing, Eyre will assume you're asking for JSON mode, so it will also fail due to the channel mode mismatch.
GET request is successful, you'll start receiving SSE events containing
@uw-encoded jams of the following structure:
$channel-event entry in the data type reference for more details.