Urbit Developers
  • Lightning Tutorials

    • Introduction
    • Build a Groups App
    • Build a Chat App
    • Build a Voting App
    • Core Curriculum

      • Hoon School

        • Introduction
        • 1. Hoon Syntax
        • 2. Azimuth (Urbit ID)
        • 3. Gates (Functions)
        • 4. Molds (Types)
        • 5. Cores
        • 6. Trees and Addressing
        • 7. Libraries
        • 8. Testing Code
        • 9. Text Processing I
        • 10. Cores and Doors
        • 11. Data Structures
        • 12. Type Checking
        • 13. Conditional Logic
        • 14. Subject-Oriented Programming
        • 15. Text Processing II
        • 16. Functional Programming
        • 17. Text Processing III
        • 18. Generic and Variant Cores
        • 19. Mathematics
        • App School I

          • Introduction
          • 1. Arvo
          • 2. The Agent Core
          • 3. Imports and Aliases
          • 4. Lifecycle
          • 5. Cards
          • 6. Pokes
          • 7. Structures and Marks
          • 8. Subscriptions
          • 9. Vanes
          • 10. Scries
          • 11. Failure
          • 12. Next Steps
          • Appendix: Types
          • App School II (Full-Stack)

            • Introduction
            • 1. Types
            • 2. Agent
            • 3. JSON
            • 4. Marks
            • 5. Eyre
            • 6. React app setup
            • 7. React app logic
            • 8. Desk and glob
            • 9. Summary
          • Environment Setup
          • Additional Guides

            • Hoon Workbook

              • Competitive Programming
              • Gleichniszahlenreihe
              • Rhonda Numbers
              • Roman Numerals
              • Solitaire Cipher
              • App Workbook

                • Building a CLI App
                • Debugging Wrapper
                • Host a Website
                • Serving a JS Game
                • Ship Monitoring
                • Styled Text
                • Threads

                  • Fundamentals
                  • Bind
                  • Input
                  • Output
                  • Summary
                • Aqua Tests
                • Remote Scry
                • Command-Line Apps
                • HTTP API
                • Eyre noun channels
                • JSON
                • Generators
                • Parsing Text
                • Sail (HTML)
                • Udon (Markdown-esque)
                • Software Distribution
                • Strings
                • Unit Tests
                • Vases
                Urbit Developers
                • Lightning Tutorials

                  • Introduction
                  • Build a Groups App
                  • Build a Chat App
                  • Build a Voting App
                  • Core Curriculum

                    • Hoon School

                      • Introduction
                      • 1. Hoon Syntax
                      • 2. Azimuth (Urbit ID)
                      • 3. Gates (Functions)
                      • 4. Molds (Types)
                      • 5. Cores
                      • 6. Trees and Addressing
                      • 7. Libraries
                      • 8. Testing Code
                      • 9. Text Processing I
                      • 10. Cores and Doors
                      • 11. Data Structures
                      • 12. Type Checking
                      • 13. Conditional Logic
                      • 14. Subject-Oriented Programming
                      • 15. Text Processing II
                      • 16. Functional Programming
                      • 17. Text Processing III
                      • 18. Generic and Variant Cores
                      • 19. Mathematics
                      • App School I

                        • Introduction
                        • 1. Arvo
                        • 2. The Agent Core
                        • 3. Imports and Aliases
                        • 4. Lifecycle
                        • 5. Cards
                        • 6. Pokes
                        • 7. Structures and Marks
                        • 8. Subscriptions
                        • 9. Vanes
                        • 10. Scries
                        • 11. Failure
                        • 12. Next Steps
                        • Appendix: Types
                        • App School II (Full-Stack)

                          • Introduction
                          • 1. Types
                          • 2. Agent
                          • 3. JSON
                          • 4. Marks
                          • 5. Eyre
                          • 6. React app setup
                          • 7. React app logic
                          • 8. Desk and glob
                          • 9. Summary
                        • Environment Setup
                        • Additional Guides

                          • Hoon Workbook

                            • Competitive Programming
                            • Gleichniszahlenreihe
                            • Rhonda Numbers
                            • Roman Numerals
                            • Solitaire Cipher
                            • App Workbook

                              • Building a CLI App
                              • Debugging Wrapper
                              • Host a Website
                              • Serving a JS Game
                              • Ship Monitoring
                              • Styled Text
                              • Threads

                                • Fundamentals
                                • Bind
                                • Input
                                • Output
                                • Summary
                              • Aqua Tests
                              • Remote Scry
                              • Command-Line Apps
                              • HTTP API
                              • Eyre noun channels
                              • JSON
                              • Generators
                              • Parsing Text
                              • Sail (HTML)
                              • Udon (Markdown-esque)
                              • Software Distribution
                              • Strings
                              • Unit Tests
                              • Vases
                              Guides/Additional Guides

                              Eyre noun channels

                              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 @urbit/js-http-api.

                              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:

                              content-type: application/x-urb-jam

                              ...and the body contains the ++jam of a list of $channel-requests with @uw base64 encoding.

                              A channel-request is defined in eyre.hoon as:

                              :: 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) (list channel-request):

                              [%delete ~]~

                              ...it is jammed to the following HEX:

                              0xACAE8CAD8CAC8F805

                              ...then encoded in the following @uw-style base64 string in the request body:

                              0w2I.HEOJz.aOfw5

                              If the body of the request is not correctly encoded as described above, it will fail with a 400 status.

                              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:

                              x-channel-format: application/x-urb-jam

                              If the 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.

                              If the GET request is successful, you'll start receiving SSE events containing @uw-encoded jams of the following structure:

                              [request-id=@ud channel-event]

                              See the $channel-event entry in the data type reference for more details.

                              <-

                              Command-Line Apps

                              HTTP API

                              ->

                              Edit this page on GitHub

                              Last modified June 13, 2023