Replies: 4 comments 4 replies
-
Hello Alejandro,
To answer most of your questions, the quickest way is to see the protocol happening live in front of you. If you can start up Sly (for emacs), pull up the
This is plain UTF-8 encoded text over TCP. Whitespace not very relevant.
Sly authenticates with a
The way |
Beta Was this translation helpful? Give feedback.
-
That is not quite what I wanted to know. Let's say you wanted to test Slynk without Emacs, you would need to build a mock client that lets you send raw bytes. So what format would the messages need to be at a byte level? Through experimentation and poking in the Slynk code I have found that I can enter the following into netcat
The message consists of a header which is always 6 bytes and gives the length of the message in hexadecimal notation, followed by the actual message. Slynk then gave me back a giant s-expression which I would have to process client-side. It looks like this format of size followed by body is used by all messages. The next question is what messages exist. What is the deal with the arguments
Makes sense, if my system is already compromised to the point where one process can just write to arbitrary ports I am already done for. And for networking it makes sense to rely on proven tools like SSH. |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, I did my best. If I was in your position, I would still open Emacs and see how it works, because Emacs contains the reference implementation of a Slynk client. If you want to build a Slynk client for Neovim, it's going to be much harder if not downright impossible if you don't want to look at this reference implementation, because there is really no better description, no real documentation besides the code. I can give you a pointer or two once in a while, of course. Besides if you're interested in doing this, you must surely be interested in Common Lisp, and if you're interested in Common Lisp, then Emacs Lisp isn't that far off a dialect.
Oh right, that's indeed 6 UTF-8 chars of indicating the length in hex. That's slightly silly but it was an inheritance from SLIME. And then the corresponding number of UTF-8 characters. I had forgotten about this detail. How did I look it up? I looked at the Elisp functions
Read |
Beta Was this translation helpful? Give feedback.
-
First, sorry for intruding, but I found the discussion interesting. For a while, I was looking at a neovim plugin project called "conjure". A swank client was already made for it, but a few months ago, a guy is rewriting the client to support slynk instead of swank. It maybe help you to understand, there's only one thing, one part of the plugin is not written in lua, but written in "fennel", a lisp that translates to lua. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm a Neovim user who wants something akin to Sly. Obviously I will have to do the client side myself, but I want to use Slynk as the server component. The first step is understanding how the protocol works so that I can connect the editor to Slynk. I know how to start a standalone Slynk process, but I don't know what format the messages need to be in.
This will cause Slynk to listen for TCP messages on some port. Next I would like to feed messages to that port using netcat. So here are my questions:
(+ 2 3)
is sent to the server for evaluation, is it simple encoded as a string?I think once I know how to exchange messages I can start chipping away at the actual Neovim plugin. At the moment I am using Vlime, which is nice, but it is very clunky. There are so many nice Neovim improvements that could be made and I would like if both communities could share the same backend tooling. I don't know Emacs Lisp, but if someone can point me to specific functions I might be able to make sense of them.
Beta Was this translation helpful? Give feedback.
All reactions