Terminate the WebSocket server thread cleanly. Use poll() instead of run().