If a 1002 error occurs on WebSocket, it is highly possible that an error has occurred on the server side.
Not limited to JavaScript, WebSocket programming may return a 1002 error code from the server.
ws.onclose = function(event) {
if (event.wasClean) {
alert("[close] Connection closed cleanly");
} else {
console.log("[close] Connection died " + event.code + "," + event.reason);
}
};
[close] Connection died 1002,An unrecoverable IOException occurred so the connection was closed
However, when I look at the console on the server side (Tomcat 8.5), nothing is displayed. I was addicted to it here.
(Why ... and half a day passed)
A closer look at the server-side code reveals that there are cases of NullPointerException, and after fixing it, it works as intended. If you get a NullPointerException, I would like it to be output on the server console as well.
Recommended Posts