WebSocket closes on send
The CloseEvent has a "code" property that will give you information about why your connection was closed.
"Returns an unsigned short containing the close code send by the server. The following values are permitted status codes."
A variety of code values are supported. Here are the most prominent:
- 1000: CLOSE_NORMAL
- 1001: CLOSE_GOING_AWAY
- 1002: CLOSE_PROTOCOL_ERROR
- 1003: CLOSE_UNSUPPORTED
- 1005: CLOSE_NO_STATUS
See CloseEvent API docs on MDN for more.