Vadim Dalecky3 years ago

Binary-Rx

Binary-Rx specifies a binary encoding format for JSON-Rx protocol. Semantically Binary-Rx is exactly the same as JSON-Rx, so it supports: (1) notifications, (2) request/response; (3) subscriptions. Syntactically this documents specifies a binary encoding format for every JSON-Rx message type.

First byteMessage
000?xxxxNotification message
001?xxxxSubscribe message
010?xxxxData message
011?xxxxComplete message
10000000Un-subscribe message
101?xxxxError message
11000000 to 11111111Reserved
10000001 to 10011111Reserved

Message encoding

Notation in diagrams:

The notification message

Notification message consists of:

  1. Remote method name string, encoded as ASCII text.

  2. Optional binary payload data.

  • ? is a bit flag which determines if the following byte should be used for decoding a variable length integer.

  • x is a variable length unsigned integer that encodes total length of the message.

  • y is a variable length unsigned integer that encodes the length of the method field.

The subscribe message

Subscribe message consists of:

  1. Subscription id, encoded as unsigned 16 bit integer.

  2. Remote method name string, encoded as ASCII text.

  3. Optional binary payload data.

  • ? is a bit flag which determines if the following byte should be used for decoding a variable length integer.

  • x is a variable length unsigned integer that encodes total length of the message.

  • y is a variable length unsigned integer that encodes the length of the method field.

The data message

Data message consists of:

  1. Subscription id, encoded as unsigned 16 bit integer.

  2. Required binary payload data.

  • ? is a bit flag which determines if the following byte should be used for decoding a variable length integer.

  • x is a variable length unsigned integer that encodes total length of the message.

The complete message

Complete message consists of:

  1. Subscription id, encoded as unsigned 16 bit integer.

  2. Optional binary payload data.

  • ? is a bit flag which determines if the following byte should be used for decoding a variable length integer.

  • x is a variable length unsigned integer that encodes total length of the message.

The un-subscribe message

Un-subscribe message consists of:

  1. Subscription id, encoded as unsigned 16 bit integer.

The error message

Error message consists of:

  1. Subscription id, encoded as unsigned 16 bit integer.

  2. Required binary payload data.

  • ? is a bit flag which determines if the following byte should be used for decoding a variable length integer.

  • x is a variable length unsigned integer that encodes total length of the message.