Add error handling for websocket