<< Click to Display Table of Contents >> Navigation: The API > JSON API > Real Time Communication > From Gateway to Client: Streaming API > Processing streaming data |
Parsing responses
The body of a streaming API response consists of a series of newline-delimited messages, where “newline” is considered to be \r\n (in hex: 0x0D 0x0A) and “message” is a JSON encoded data structure or a blank line.
See streaming message types for information about the message formats you will receive from the streaming API.
JSON data
The individual messages streamed by this API are JSON encoded. Keep in mind that the attributes of a JSON-encoded text are unordered - do not rely on fields appearing in any given order. Also keep in mind that your JSON parser should tolerate unexpected or missing fields.
Transfer-Encoding: chunked
Streaming connections are encoded using chunked transfer encoding, as indicated by the presence of a Transfer-Encoding: chunked HTTP header in the response. Because most HTTP libraries deal with chunked transfer encoding transparently, this document will assume that your code has access to the reassembled HTTP stream and does not have to deal with this encoding.