Skip to content

Instantly share code, notes, and snippets.

@tav
Created December 5, 2012 16:48
Show Gist options
  • Select an option

  • Save tav/4217316 to your computer and use it in GitHub Desktop.

Select an option

Save tav/4217316 to your computer and use it in GitHub Desktop.

The messages are encoded in the Argonought binary serialisation format and contain the following fields:

  • Frame Version
  • Frame Type
  • Frame Flags
  • Frame Length
  • Stream ID
  • Stream Priority
  • Stream Sequence Number (when UDP is used)
  • Data
  • Operation Code
  • Headers
  • Application Data

Message Types:

  • HELLO
  • STREAM_START
  • STREAM_CONTINUE
  • STREAM_REPLY
  • STREAM_CLOSE
  • STREAM_RESET
  • CHANGE_SETTINGS
  • PING
  • PONG
  • BYE_BYE

Message opcodes are custom definable by applications and the arguments are set via the headers. A handful of core opcodes are defined:

  • GET
  • PUT
  • REACT
  • INFO
  • SET_SENSOR
  • REMOVE_SENSOR

A client initiates a connection using a HELLO frame with a payload defining settings for the connection. Independent request/response streams are then multiplexed over this connection.

Native support is provided for security — authentication, authorization and encryption. These are negotiated through the initial HELLO and subsequent CHANGE_SETTINGS messages.

Senders (either the client or server) start a new stream by sending a STREAM_START frame and may follow up with additional payloads using STREAM_CONTINUE frames. The stream can then be closed with a STREAM_CLOSE frame or the receiver can terminate a stream in mid-flow with a STREAM_RESET frame.

If the ASYNC_REQUEST flag was set, the receiver does not have to respond immediately. Otherwise, the receiver responds with a STREAM_REPLY frame with any additional data sent with STREAM_CONTINUE frames.

The client can update the connection settings by sending a CHANGE_SETTINGS frame at any time. And, likewise, it can gracefully let the server know that it's closing the connection by sending a BYE_BYE frame.

The protocol allows for request/respond streams to be multiplexed over a single connection. It allows for resources to be accessed and updated over the network. As well as for asynchronous messages to be passed between the server and client. Of special note is the ability for sensors to be placed which allows for the sending of updates when data matching specific patterns are created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment