Hi, I'm developing a JSON-RPC and LSP library usin...
# ktor
r
Hi, I'm developing a JSON-RPC and LSP library using Ktor and kotlin.serialization (https://github.com/rhdunn/xqt-kotlin-lsp) and I'm trying to understand how best to build the communication on top of Ktor. I have the JSON object serialization/deserialization figured out. 1. Is it possible to re-use the Ktor header parsing on top of a ByteReadChannel -- e.g. from a socket? -- This is needed for handling the LSP header section for JSON-RPC messages. 2. Is there support for stdio byte channels? (and other byte channels like socket files, windows pipes, node-ipc, etc.) If not, is there any documentation/examples for doing this? -- This is so I can get the byte channels for a given communication type and then use the same code for routing the JSON messages.
a
1. You can use the parseHeaders method to parse a
ByteReadChannel
into a
HttpHeadersMap
. 2. Unfortunately, the Kotlin stdlib doesn’t have such functionality.
r
Thanks.
189 Views