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

Detecting close status code #38

Open
ProChirathF opened this issue Jun 10, 2022 · 0 comments
Open

Detecting close status code #38

ProChirathF opened this issue Jun 10, 2022 · 0 comments

Comments

@ProChirathF
Copy link

When a websocket is closed by the remote client, is there a way to identify the connection close status code?, I am implementing a reconnection feature & it is important to identify if it is a clean close or a abrupt failure. Websockt spec defines these codes
https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1 7 & browsers do implement these status codes. SockJs server also sends codes such as 3000 Go away, which gets propagated to browsers onClose event.

Eg:
Javascript on close event payload
{
"type": "close",
"bubbles": false,
"cancelable": false,
"timeStamp": 1654833914457,
"wasClean": true,
"code": 3000,
"reason": "Go away!"
}

https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code

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