Properly (properly) run and shut down WebSocket server