summaryrefslogtreecommitdiffstats
path: root/runtime/doc/channel.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-26 17:58:53 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-26 17:58:53 +0200
commitf1f0792e55e72cdc7c833b30f565a9b02f18bb1e (patch)
tree0c63bd3971cde94874394587ca3bede776f87abf /runtime/doc/channel.txt
parent9f28953f0c1e3d9fffd49af76503f54eaa279acb (diff)
patch 7.4.2258v7.4.2258
Problem: Two JSON messages are sent without a separator. Solution: Separate messages with a NL. (closes #1001)
Diffstat (limited to 'runtime/doc/channel.txt')
-rw-r--r--runtime/doc/channel.txt10
1 files changed, 8 insertions, 2 deletions
diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt
index 9a5d36da26..f0c56e9405 100644
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -1,4 +1,4 @@
-*channel.txt* For Vim version 7.4. Last change: 2016 Jul 15
+*channel.txt* For Vim version 7.4. Last change: 2016 Aug 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -247,9 +247,15 @@ In which {number} is different every time. It must be used in the response
This way Vim knows which sent message matches with which received message and
can call the right handler. Also when the messages arrive out of order.
+A newline character is terminating the JSON text. This can be used to
+separate the read text. For example, in Python:
+ splitidx = read_text.find('\n')
+ message = read_text[:splitidx]
+ rest = read_text[splitidx + 1:]
+
The sender must always send valid JSON to Vim. Vim can check for the end of
the message by parsing the JSON. It will only accept the message if the end
-was received.
+was received. A newline after the message is optional.
When the process wants to send a message to Vim without first receiving a
message, it must use the number zero: