Protocol
Communication with Xenophobe involves a bidirectional stream of JSON messages, encoded as UTF-8, sent over SSH.
Example requests and responses in this documentation are pretty-printed in places for clarity. On the feed itself, JSON objects sent in either direction must not contain newlines but are terminated with a single newline character (ASCII char 10 or 0x0A). This is to make it easier both to split out individual messages and to detect malformed requests.
There are two situations in which the server will send data to the client. One is that the client has made a request of some sort, in which case the server will send back response consisting of a JSON object containing a top-level key-value pair:
We refer to these as “Response” messages. The second situation is that the server just needs to push some data, such as a price change, to the client. In this case, the JSON object will contain top-level key-value pair:
These are “Push” messages and may be sent by the server at any time after the initial login and registration requests are received and their responses sent, but never before.
Client requests will always receive a corresponding response message, but there may be Push messages sent in between the client sending the request and receiving the response, especially in the case where the client has subscribed to a data feed.
Last updated
Was this helpful?