rsocket-js icon indicating copy to clipboard operation
rsocket-js copied to clipboard

feat: allow closing a WebSocket server outside of the ServerCloseable

Open stevensJourney opened this issue 8 months ago • 2 comments

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 avatar Jun 11 '24 09:06 stevensJourney