From f1f0792e55e72cdc7c833b30f565a9b02f18bb1e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 26 Aug 2016 17:58:53 +0200 Subject: patch 7.4.2258 Problem: Two JSON messages are sent without a separator. Solution: Separate messages with a NL. (closes #1001) --- runtime/doc/channel.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'runtime/doc/channel.txt') 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: -- cgit v1.2.3