R Session Manager. Is it the package we are talking about recently? I’m quite interested in the underlying protocol since there’s a too much bit of hacking in the vscode R session watcher script.
session <- sess::start("127.0.0.1", 5000, debug = TRUE)
in R, it could be
ws <- websocket::WebSocket$new("ws://127.0.0.1:5000/") ws$send(jsonlite::toJSON(list(jsonrpc = "2", id = 1, method = "initialize"), auto_unbox = TRUE))
other languages could use their own websocket library too. For example,
websocket-clientmodule of python
session$broadcastmethod for the server to send messages to the clients
Hi, currently VS Code can only communicate with the session watcher by sending code directly to the terminal. I was thinking that it would be nice if this could happen in the background. But I like the way that when you use R in VS Code you're 'just using the terminal', because it makes it easy to use radian, tmux etc. It's different from RStudio, where RStudio hosts the session in its own special terminal.
Summarising, my desiderata are:
I was playing around just now with https://github.com/corynissen/r-socket-server . First I start a
source("server.R") server() # On localhost port 6011
Then, in a separate window, I can do
nc localhost 6011 hello
and I get the output 'HELLO' back from the server. So this sort of achieves my aim of having an R session on a server that you can also communicate with via the terminal. Although in this setup I don't know how you'd use radian.
So! My questions are: