Skip to content

feat: allow closing a WebSocket server outside of the ServerCloseable - #279

Open
stevensJourney wants to merge 1 commit into
rsocket:1.0.x-alphafrom
stevensJourney:feat/externally-close-websocket-server
Open

feat: allow closing a WebSocket server outside of the ServerCloseable#279
stevensJourney wants to merge 1 commit into
rsocket:1.0.x-alphafrom
stevensJourney:feat/externally-close-websocket-server

Conversation

@stevensJourney

Copy link
Copy Markdown

Allows for not managing closing of the WebSocket server externally from the ServerCloseable.

Motivation:

In my use case I provide an existing WebSocket server using the wsCreator factory. This server's lifecycle is managed externally.

In the current implementation if I close my WebSocket server externally then the close listener will trigger the ServerCloseable's close method which will attempt to close the server again which will fire another close event and trigger the ServerCloseable's close method for a second time: this prints a warning for attempting to close for the second time.

Modifications:

I've added an option to externally manage closing of the server. This will optionally prevent the ServerCloseable from closing the server.

Result:

An additional option will be available when creating a WebSocketServerTransport. If this option is enabled the WebSocketServer should be closed externally.

Signed-off-by: Steven Ontong <steven@journeyapps.com>
@stevensJourney
stevensJourney force-pushed the feat/externally-close-websocket-server branch from 54bdb83 to 0d2b8b4 Compare June 11, 2024 09:38
@viglucci viglucci added 1.0 Pullrequests & issues related to the Typescript rewrite and 1.0 release needs triage Issue/PR needs triage by a project maintainer labels Jun 14, 2024
@viglucci

viglucci commented Jun 15, 2024

Copy link
Copy Markdown
Member

Hey @stevensJourney -- thanks for these PRs. I'm working on adding test coverage to the affected files. Ideally you can update your fork with the tests once they exist, and then I'll loop back around to reviewing your changes.

@stevensJourney

Copy link
Copy Markdown
Author

Hey @stevensJourney -- thanks for these PRs. I'm working on adding test coverage to the affected files. Ideally you can update your fork with the tests once they exist, and then I'll loop back around to reviewing your changes.

Thanks for the quick response @viglucci . I'm happy to assist wherever possible with the approach suggested. Thanks for all the great work!

@viglucci
viglucci self-requested a review August 2, 2024 01:47
alexey-sh pushed a commit to alexey-sh/rsocket that referenced this pull request Jul 24, 2026
)

Both ServerCloseable implementations closed the listening socket but
called super.close() without the error, so onClose listeners were
notified with `undefined` even when the server closed due to an error.
Forward it: super.close(error).

Replace the tcp-server placeholder spec (also mis-named "TcpClientTransport")
with a real test that injects a stubbed net.Server -- no real port -- and
asserts bind()'s Closeable closes the server and reports both an error
close and a clean close to onClose.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
alexey-sh pushed a commit to alexey-sh/rsocket that referenced this pull request Jul 24, 2026
Adds the initial-requestN validation (M1 follow-up), M4, L2, rsocket#279 and L1
to the correctness table; the Buffer lint guard and check:exports to
Ecosystem/DX; bumps the fix count; and trims "Still planned" to the
npm-scope publish, noting L3 and M6 were investigated and intentionally
left unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.0 Pullrequests & issues related to the Typescript rewrite and 1.0 release needs triage Issue/PR needs triage by a project maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants