-
Provided you offload some state as to who is connected, and you shutdown the server gracefully on SIGINT (i.e. scaling down), what's the approach one needs to take to invoke the close handler so the external state can be updated with the latest status for the now disconnected clients. I am simply doing this from the graceful shutdown example and not seeing the close handler get invoked, like it does when the client disconnects.
I can manually keep track of connected clients and do that in a manual drain call, but wondering if there's a better way/there's something I'm missing. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
@alexhultman can you shed some light as to if this is a correct read of what's going on in this case: When WebSocket.end gets called, it sets Then when Wondering what the rationale is behind this? |
Beta Was this translation helpful? Give feedback.
-
This is by design. You're closing the listen socket. This has nothing to do with the websockets, they remain open. If you want to close the websockets then you call close on them |
Beta Was this translation helpful? Give feedback.
-
@alexhultman The server is closed and the connections are closed so the websockets do not "remain open" so unclear what you are talking about? |
Beta Was this translation helpful? Give feedback.
-
If your websockets are closed then of course they won't invoke its close handler, as they already are closed. So I fail to follow the logic in your report. I can recommend reading the user manual, it is very clear on this topic. |
Beta Was this translation helpful? Give feedback.
This is by design. You're closing the listen socket. This has nothing to do with the websockets, they remain open.
If you want to close the websockets then you call close on them