Added api client error handling in websocket server