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 #2393

Open
huajingze opened this issue Jan 4, 2020 · 1 comment
Open

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

huajingze opened this issue Jan 4, 2020 · 1 comment

Comments

@huajingze
Copy link

huajingze commented Jan 4, 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;
@jfarcand
Copy link
Member

jfarcand commented Jan 6, 2020

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

2 participants