lets_code_javascript
lets_code_javascript copied to clipboard
RTS stop 3
I suggest rewriting the cleanup logic to ask RealTimeServer to disconnect all open sockets before stopping the http server.
This code is still somewhat a hack, because I don't quite understand why I need some setTimeout() wrappers around done, but I still think this is a lot better. Also the private variable RealTimeServer._disconnectAllCallback can be debated, but doing it like this we can keep numberOfActiveConnections() as a private method without explicit testing.
This is my preferred PR of 3 to improve the shutdown logic.