-
-
Notifications
You must be signed in to change notification settings - Fork 166
Explicit Framing Protocol Proposal
emdash edited this page Jun 1, 2019
·
5 revisions
Inspired by: https://tools.ietf.org/html/rfc6455#section-5
Key idea: "framed channels" for working with arbitrary data over byte streams.
Message (a.k.a. "Record", a.k.a. "Packet") is a variable-length chunk of arbitrary bytes. Can contain newlines, nulls, etc. Quoting is not required for data sent in framed packets. Escaping is done through filters.
-
put
operation copies writes a message with bytes of argument as payload to stdout - syntax? i.e. `put "${foo}" > socket'
-
get
operation reads one frame from stdin, copies bytes into argument. -
escape
filter reads one frame, outputs escaped version:escape --json < socket
-
unescape
lifts from plaintext stream to framed channel:unescape -d',' --json > socket
Questions:
- can we use strings as byte buffers, or does there need to be a byte buffer type?
- I.e. What happens if an oil string contains an embedded null?
- Is it better if
get
put
work more likeread
, and interpret their argument as the name of a var? - i.e.
put foo > socket
vs .put "${foo}" > socket
.