Skip to content

chore: use node 22 Set methods for websocket close state#4974

Closed
trivikr wants to merge 1 commit intonodejs:mainfrom
trivikr:set-methods
Closed

chore: use node 22 Set methods for websocket close state#4974
trivikr wants to merge 1 commit intonodejs:mainfrom
trivikr:set-methods

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Apr 4, 2026

This relates to...

N/A

Rationale

Node.js 22 supports the new Set relation methods, which make the WebSocket closing-handshake checks more explicit. This change centralizes the closing-handshake state set in the WebSocket constants module and reuses it across the WebSocket implementation instead of redefining it in multiple files.

Changes

  • Add closingHandshakeStates to the WebSocket constants module
  • Document closingHandshakeStates with JSDoc
  • Replace duplicated local closing-handshake sets with the shared constant
  • Use Set.prototype.isDisjointFrom() and Set.prototype.isSupersetOf() for closing-handshake checks

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.09%. Comparing base (79b7ebd) to head (fe13149).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4974   +/-   ##
=======================================
  Coverage   93.09%   93.09%           
=======================================
  Files         110      110           
  Lines       35801    35811   +10     
=======================================
+ Hits        33330    33340   +10     
  Misses       2471     2471           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina requested a review from KhafraDev April 5, 2026 15:26
@trivikr trivikr force-pushed the set-methods branch 3 times, most recently from aca3345 to 552af7a Compare April 20, 2026 15:50
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@KhafraDev
Copy link
Copy Markdown
Member

which make the WebSocket closing-handshake checks more explicit

I don't agree and the code doesn't agree either. You wouldn't need to partially explain set theory in the comment if it was explicit.

Having to duplicate the states in a new set is also just not good code.

@trivikr trivikr closed this Apr 21, 2026
@trivikr trivikr deleted the set-methods branch April 21, 2026 15:11
@trivikr
Copy link
Copy Markdown
Member Author

trivikr commented Apr 21, 2026

Having to duplicate the states in a new set is also just not good code.

Closing as this change is not good code, according to one of the maintainers.

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.

4 participants