Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the websocket close code with atmosphere.js #251

Open
huajingze opened this issue Jan 3, 2020 · 0 comments
Open

How to get the websocket close code with atmosphere.js #251

huajingze opened this issue Jan 3, 2020 · 0 comments

Comments

@huajingze
Copy link

huajingze commented Jan 3, 2020

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant