How can I know if the server socket is closed? #801
-
I understand that the recommend way for graceful shutdown is to close all timers, all websocket connections, and then close the socket (us_listen_socket_close). This is fine. But in my use case, I need to do some task after the socket is closed and then only shutdown the process. Usual node http servers provide a 'close' event, which is run when the socket is closed. I didn't find any such event in uWS, and neither could I think of any other way to solve this problem. Could you please shed some light on how to solve this? I think, uWS could add a 'close' event or allow an optional callback to us_listen_socket_close. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I see the problem but you can use the regular nodejs process "about to exit" events. In C++ you explicitly call app.run() and can see when that call returns (that's essentially the "event" you need). But in nodejs there is no app.run call |
Beta Was this translation helpful? Give feedback.
I see the problem but you can use the regular nodejs process "about to exit" events. In C++ you explicitly call app.run() and can see when that call returns (that's essentially the "event" you need). But in nodejs there is no app.run call