Skip to content

feat: send WebSocket ping frames#17

Open
qwertycxz wants to merge 3 commits into
marimo-team:mainfrom
qwertycxz:master
Open

feat: send WebSocket ping frames#17
qwertycxz wants to merge 3 commits into
marimo-team:mainfrom
qwertycxz:master

Conversation

@qwertycxz

Copy link
Copy Markdown

Introduce a --ping <ms> option, adds support for sending periodic WebSocket ping frames to clients.

Copilot AI review requested due to automatic review settings May 23, 2026 06:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an optional WebSocket keepalive ping interval configurable via CLI and server options to help keep idle connections alive.

Changes:

  • Added ping option to startWebSocketServer and threaded it into handleWebSocketConnection.
  • Implemented per-connection setInterval to send WebSocket ping frames and cleared it on socket close.
  • Exposed --ping <ms> in CLI help and argument defaults.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/stdio-to-ws.ts Adds ping option and per-connection ping timer lifecycle management.
src/main.ts Adds CLI flag/default wiring for --ping and passes it to server start.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main.ts
Comment thread src/main.ts Outdated
Comment thread src/stdio-to-ws.ts
Comment on lines +99 to +100
if (ping) {
interval = setInterval(() => webSocket.ping(), ping);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

IMO, it is not quite necessary.

Comment thread src/stdio-to-ws.ts
Comment on lines +98 to +101
let interval: NodeJS.Timeout | null = null;
if (ping) {
interval = setInterval(() => webSocket.ping(), ping);
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

What do you think?

@qwertycxz

Copy link
Copy Markdown
Author

Hi @marimo-team, just a gentle ping on my PR #17 — it’s been a week and I’d love to get some feedback when you have a moment. Thanks!

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