Properly disable WebSocket server and properly synchronize needed things