add onerror function to websocket on client