https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
1015 TLS Handshake Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified).
см .: Совместимость браузера
Пример Chrome (версия 71.0) возвращает ошибку 1006, Firefox (версия 64.0 (64-разрядная версия)) 1015:
<script>
try{
var websocket = new WebSocket("wss://self-signed.badssl.com/");
websocket.onopen = function (event) {
};
websocket.onclose = function (event) {
var reason;
alert(event.code);
};
websocket.onmessage = function (event) {
};
websocket.onerror = function (event) {
};
}
catch(err){
document.getElementById("demo").innerHTML = err.message;
}
</script>
<p id="demo"></p>