atmosphere-javascript icon indicating copy to clipboard operation
atmosphere-javascript copied to clipboard

How to get the websocket close code with atmosphere.js

Open huajingze opened this issue 6 years ago • 0 comments

Our project use atmosphere.js , now I could get the response code is 200 from the "onClose" function. Request.onClose(Response) {}

how to get the specified close code from the onClose function, such as 1000 or 1001. Because I need to recoginze whether the browser close the websocket or the server side close the websocket.
Thanks much.

``
case 1000: reason = "Normal closure; the connection successfully completed whatever purpose for which it was created."; break; case 1001: reason = "The endpoint is going away, either because of a server failure or because the " + "browser is navigating away from the page that opened the connection."; break; case 1002: reason = "The endpoint is terminating the connection due to a protocol error."; break;

huajingze avatar Jan 03 '20 16:01 huajingze