Skip to content

Conversation

@DanTup
Copy link
Member

@DanTup DanTup commented Dec 2, 2025

Users with Norton 360 installed found that if there is no traffic over the WebSocket for 60s, it gets dropped. This appears to be that the connections are proxied (even if all scanning is disabled) and "idle" connections are dropped.

This forces traffic ever 15s which will prevent them from dropping the connection.

Fixes #5794

@DanTup DanTup added this to the v3.124.1 milestone Dec 2, 2025
@DanTup DanTup added is bug fix in dtd Relates to integration with the Dart Tooling Daemon labels Dec 2, 2025
@DanTup DanTup requested a review from Copilot December 2, 2025 11:06
@DanTup

This comment was marked as outdated.

gemini-code-assist[bot]

This comment was marked as outdated.

@chatgpt-codex-connector

This comment was marked as outdated.

This comment was marked as outdated.

…ton) dropping the connection

Users with Norton 360 installed found that if there is no traffic over the WebSocket for 60s, it gets dropped. This appears to be that the connections are proxied (even if all scanning is disabled) and "idle" connections are dropped.

This forces traffic ever 15s which will prevent them from dropping the connection.

Fixes #5794
@DanTup DanTup requested a review from Copilot December 2, 2025 11:30
@DanTup
Copy link
Member Author

DanTup commented Dec 2, 2025

@codex review
/gemini review

@gemini-code-assist
Copy link

I've received your request for a code review. Here's a summary of my findings for this pull request:

Overall Impression:
The changes effectively address the reported issue of WebSocket connections being dropped by proxies due to inactivity. The solution is well-encapsulated, clearly documented, and includes a dedicated test.

Key Points:

  • Correctness: The attachPing function correctly implements a keep-alive mechanism by sending WebSocket pings at a regular interval (15 seconds). It handles different socket states (open, closed, error) and ensures proper resource cleanup.
  • Efficiency: The chosen ping interval of 15 seconds is a good balance, frequent enough to prevent idle timeouts (e.g., 60 seconds for Norton 360) without introducing excessive network overhead.
  • Maintainability: The new attachPing utility function is placed in a logical location (src/shared/utils/ws.ts) and is well-documented with a clear purpose and explanation of the problem it solves. The code is readable and follows good practices.
  • Testing: A dedicated unit test (src/test/dart/utils/ws.test.ts) has been added to verify the functionality of attachPing, ensuring that pings are indeed sent.

No critical or high-severity issues were identified. The changes are a solid improvement for connection stability.

If you intended to trigger a full, line-by-line review with specific suggestions, please note that this comment provides a high-level summary. For a detailed review, you would typically initiate a new review submission through the platform's review features.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


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

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment on lines +5 to +32
describe("attachPing", () => {
let server: http.Server;
let wss: ws.Server;

beforeEach(() => {
server = http.createServer();
wss = new ws.Server({ server });
server.listen();
});

afterEach(() => {
wss.close();
server.close();
});

it("sends pings", async () => {
const serverReceivedPingPromise = new Promise((resolve) => wss.once("connection", (c) => c.once("ping", resolve)));

const port = (server.address() as any).port;
const socket = new ws.WebSocket(`ws://localhost:${port}`);
attachPing(socket, 10); // 10ms interval to avoid test taking long.

// Wait for the server to get a ping.
await serverReceivedPingPromise;

socket.close();
});
});
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

[nitpick] The test suite only covers the happy path (sending pings). Consider adding tests for edge cases such as:

  1. Socket closing before/after ping starts - verify cleanup happens correctly
  2. Socket error during ping - verify error handler clears the interval
  3. Attaching ping to an already-open socket vs. a connecting socket

These additional tests would ensure the cleanup logic (removeListener calls) and error handling work correctly.

Copilot uses AI. Check for mistakes.
@DanTup DanTup merged commit 2a8ac64 into master Dec 2, 2025
22 checks passed
@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanTup DanTup deleted the websocket-ping branch December 2, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in dtd Relates to integration with the Dart Tooling Daemon is bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dart Tooling Daemon connection terminates after 60s idle with Norton antivirus installed

2 participants