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 byte | Message |
---|---|
000?xxxx | Notification message |
001?xxxx | Subscribe message |
010?xxxx | Data message |
011?xxxx | Complete message |
10000000 | Un-subscribe message |
101?xxxx | Error message |
11000000 to 11111111 | Reserved |
10000001 to 10011111 | Reserved |
Notation in diagrams:
Notification message consists of:
Remote method
name string, encoded as ASCII text.
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.
Subscribe message consists of:
Subscription id
, encoded as unsigned 16 bit integer.
Remote method
name string, encoded as ASCII text.
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.
Data message consists of:
Subscription id
, encoded as unsigned 16 bit integer.
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.
Complete message consists of:
Subscription id
, encoded as unsigned 16 bit integer.
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.
Un-subscribe message consists of:
Subscription id
, encoded as unsigned 16 bit integer.
Error message consists of:
Subscription id
, encoded as unsigned 16 bit integer.
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.