Skip to content

refactor!: replace WebSocket/TCP transport with Unix socket / Windows named pipe#1699

Open
eitsupi wants to merge 7 commits intoREditorSupport:masterfrom
eitsupi:feat/ipc-named-pipe
Open

refactor!: replace WebSocket/TCP transport with Unix socket / Windows named pipe#1699
eitsupi wants to merge 7 commits intoREditorSupport:masterfrom
eitsupi:feat/ipc-named-pipe

Conversation

@eitsupi
Copy link
Copy Markdown
Contributor

@eitsupi eitsupi commented May 5, 2026

Replace the WebSocket-over-TCP IPC between vscode and R sessions with a Unix domain socket (Linux/Mac) or Windows named pipe transport.

eitsupi added 4 commits May 5, 2026 05:52
Replace the WebSocket-over-TCP IPC between vscode and R sessions with
a Unix domain socket (Linux/Mac) or Windows named pipe transport.

Changes:
- session.ts: create net.Server pipe instead of WebSocket.Server;
  use NDJSON framing (\n-delimited JSON) for message boundaries;
  remove token-based authentication (filesystem permissions suffice)
- rTerminal.ts: pass SESS_PIPE env var instead of SESS_PORT + SESS_TOKEN
- sess/R/server.R: connect via processx::conn_connect_unix_socket();
  drive message dispatch through a later::later() polling loop
- sess/R/dispatch.R: send via processx::conn_write() + NDJSON framing
- sess/DESCRIPTION: swap websocket dep for processx (>= 3.5.0);
  add testthat to Suggests
- sess/tests/testthat/test-ipc.R: unit tests for socket round-trip,
  dispatch_message routing, and ipc_write guard
@eitsupi eitsupi changed the title replace WebSocket/TCP transport with Unix socket / named pipe refactor!: replace WebSocket/TCP transport with Unix socket / named pipe May 5, 2026
@eitsupi eitsupi force-pushed the feat/ipc-named-pipe branch from b50c828 to fdc193b Compare May 5, 2026 06:17
@eitsupi eitsupi marked this pull request as ready for review May 5, 2026 06:19
Comment thread sess/R/server.R
# Derive file path for fallback/reconnection
# Fallback: read from session JSON file written by the extension
pid <- Sys.getpid()
home <- path.expand("~")
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should refer to My Documents on Windows, so it's probably not what you intended.

@eitsupi eitsupi changed the title refactor!: replace WebSocket/TCP transport with Unix socket / named pipe refactor!: replace WebSocket/TCP transport with Unix socket / Windows named pipe May 5, 2026
@randy3k
Copy link
Copy Markdown
Member

randy3k commented May 5, 2026

thanks for working on it, didn't know that _unix_socket works for windows named pipe. LGTM at the first glance, will take a closer look tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants