I want the javascript client process to receive the HTTP status code returned by the server when the client makes a websocket update request and this request is unsuccessful.
I have a server returning HTTP 400 to indicate that the website update was unsuccessful.
I am using Google Chrome, and when I open the developer console, I can see the following message:
WebSocket connection to "wss: //" failed: WebSocket handshake error: unexpected response code: 400
However, the onerror handler does not contain this message, it receives error 1006, but does not indicate that the closure occurred as a result of receiving HTTP 400.
How does a javascript developer handle handshake errors? I would like to provide the client with an informative message when they receive an acknowledgment error.
I put the websocket error below, it doesn't seem to contain anything that I can use to indicate that this error is the result of a websocket communication error.
Websocket Error: {"path":{"length":0},"cancelBubble":false,"returnValue":true,"srcElement":{"binaryType":"blob","protocol":"","extensions":"","bufferedAmount":0,"readyState":3,"url":"wss://<my address>","URL":"wss://<my address>"},"defaultPrevented":false,"timeStamp":1417828938039,"cancelable":false,"bubbles":false,"eventPhase":2,"currentTarget":{"binaryType":"blob","protocol":"","extensions":"","bufferedAmount":0,"readyState":3,"url":"wss://<my address>","URL":"wss://<my address>"},"target":{"binaryType":"blob","protocol":"","extensions":"","bufferedAmount":0,"readyState":3,"url":"wss://<my address>","URL":"wss://<my address>"},"type":"error"}