Hi, bram.
As patch 7.4.1252 said, channel servers may receive multiple messages concatenated like this one ([1,"hello!"][2,"hello!"]).
It may also occurs in every channel servers including sample demoserver.py ($VIMRUNTIME/tools/demoserver.py)
function! s:test() abort let handle = ch_open('localhost:8765') for _ in range(10) call ch_sendexpr(handle, 'hello!') endfor endfunction call s:test()
We can see following server error like this.
=== socket opened ===
received: [1,"hello!"][2,"hello!"][3,"hello!"][4,"hello!"][5,"hello!"][6,"hello!"][7,"hello!"][8,"hello!"]
json decoding failed
received: [9,"hello!"][10,"hello!"]
json decoding failed
=== socket closed ===
patch 7.4.1252 fixed the test server by finding ][, but it doesn't handle messages which contains ][.
On top of that, every channel servers, regardless of programing language, have to handle this problem.
It's possible, but really troublesome to handle messages correctly.
So, I suggest to use '\n' as delimiter which is handy for channel servers, regardless of programing language, to handle messages.
How do you think?
I guess we cannot change channel specification after Vim 8.0 release, so we should include this change or include other solution.
This pull request doens't include doc changes nor demoserver.py improvement.
This pull request just intends to show the problem and disscuss it. Of course, you can discard this patch.
This patch includes @k-takata's work. Thanks @k-takata.
https://github.com/vim/vim/pull/1001
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, .![]()
I confirmed it works.
Thank you for the fix!