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