Fix WebSocket reconnection behaviour