Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: 1.0.x-alpha
Choose a base branch
from

Conversation

stevensJourney
Copy link

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.

@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
Copy link
Member

viglucci commented Jun 15, 2024

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
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!

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