mirror of
https://github.com/ok-home/ota_ws_update.git
synced 2025-11-13 22:03:27 +03:00
detect ws/wss
This commit is contained in:
@@ -236,7 +236,9 @@
|
|||||||
|
|
||||||
<script> // основной старт скрипта, открыть сокет
|
<script> // основной старт скрипта, открыть сокет
|
||||||
// создать сокет по адресу
|
// создать сокет по адресу
|
||||||
let wsHostStr = "ws://" + document.location.host + document.location.pathname;
|
let protocol = "ws:"
|
||||||
|
if(document.location.protocol == "https:") protocol = "wss:"
|
||||||
|
let wsHostStr = protocol + "//" + document.location.host + document.location.pathname;
|
||||||
wsHostStr += (document.location.pathname == '/') ? "ws" : "/ws";
|
wsHostStr += (document.location.pathname == '/') ? "ws" : "/ws";
|
||||||
var socket = new WebSocket(wsHostStr);
|
var socket = new WebSocket(wsHostStr);
|
||||||
socket.binaryType = "arraybuffer";
|
socket.binaryType = "arraybuffer";
|
||||||
|
|||||||
Reference in New Issue
Block a user