From fadc42453aca482a9db4f5c92adf58d43d87cdc7 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 22 Jun 2019 18:10:03 +0200 Subject: Implement JSON framing function (Fixes #2) --- plugins/framing_json.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 plugins/framing_json.md (limited to 'plugins/framing_json.md') diff --git a/plugins/framing_json.md b/plugins/framing_json.md new file mode 100644 index 0000000..c5a7e09 --- /dev/null +++ b/plugins/framing_json.md @@ -0,0 +1,16 @@ +# The `json` framing function + +The `json` framing function segments the peer stream at boundaries defined by complete JSON +entities (Objects, Arrays, Strings or Values) and forwards these as text frames. + +For example, on encountering the start of a JSON object at the beginning of the stream, it will read from the +peer until that objects closing brace and the send the entire object as a single text frame. + +The plugin does not implement a full parser and performs only rudimentary syntactic analysis to determine +the end of the current entity. When encountering an error, the entire buffer is forwarded as a binary frame. +It is possible to construct erroneous JSON objects that pass the parser without an error, however any +syntactically correct object should be forwarded correctly (please file a bug with an example otherwise). + +## Configuration + +The `json` framing function does not require any configuration. -- cgit v1.2.3