Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Files

Latest commit

 

History

History
21 lines (14 loc) · 1.29 KB

stream.md

File metadata and controls

21 lines (14 loc) · 1.29 KB

stream - Reliable Data Streams

One of the most common patterns between any two endpoints is creating streams of data. The "type":"stream" reliable channel is a request from one endpoint to open a stream to another.

The stream open request may contain a single additional packet attached as the BODY; this contains the options for this stream request, which should communicate anything the recipient app needs to determine what the stream is for and how to create it.

{
  "c":1,
  "type":"stream"
}
BODY: ...

Once accepted (and once the open packet is acknowledged), the stream may immediately begin sending data in either direction. All streamed data is attached as the binary BODY to every packet. The JSON may contain one of the following options:

  • "frag":true - when set, the attached BODY should be buffered along with any other fragments in order, until a packet is received without a frag at which time they are all processed
  • "enc":"..." - what encoding is the attached data, current options are: binary (default), json, and lob. This applies to any buffered fragments as well at the time it is processed (enc is not valid to be set when frag is true).

Any channel end or err is processed normally and has the same implications for a stream.