Workaround for Safari + Websockets + basic auth

https://bugs.webkit.org/show_bug.cgi?id=80362
This commit is contained in:
Devaev Maxim
2018-08-11 03:46:42 +03:00
parent 3d2282f8f9
commit ba650456aa
4 changed files with 51 additions and 14 deletions

View File

@@ -20,11 +20,19 @@ var session = new function() {
};
this.startPoller = function() {
__ws = new WebSocket((location.protocol == "https:" ? "wss" : "ws") + "://" + location.host + "/kvmd/ws");
__ws.onopen = __wsOpenHandler;
__ws.onmessage = __wsMessageHandler;
__ws.onerror = __wsErrorHandler;
__ws.onclose = __wsCloseHandler;
var http = tools.makeRequest("GET", "/wsauth", function() {
if (http.readyState === 4) {
if (http.status === 200) {
__ws = new WebSocket((location.protocol == "https:" ? "wss" : "ws") + "://" + location.host + "/kvmd/ws");
__ws.onopen = __wsOpenHandler;
__ws.onmessage = __wsMessageHandler;
__ws.onerror = __wsErrorHandler;
__ws.onclose = __wsCloseHandler;
} else {
__wsCloseHandler(null);
}
}
});
};
var __wsOpenHandler = function(event) {