mirror of https://github.com/tp4a/teleport
修正:websocket区分http和https两种连接方式。
parent
9425afc3eb
commit
396312ece1
|
@ -457,7 +457,13 @@ $app.init_ws = function () {
|
||||||
delete $app.ws;
|
delete $app.ws;
|
||||||
|
|
||||||
var _sid = Cookies.get('_sid');
|
var _sid = Cookies.get('_sid');
|
||||||
$app.ws = new WebSocket('ws://' + location.host + '/ws/' + _sid);
|
console.log(location);
|
||||||
|
console.log(location.host);
|
||||||
|
if(location.protocol === 'http') {
|
||||||
|
$app.ws = new WebSocket('ws://' + location.host + '/ws/' + _sid);
|
||||||
|
} else {
|
||||||
|
$app.ws = new WebSocket('wss://' + location.host + '/ws/' + _sid);
|
||||||
|
}
|
||||||
|
|
||||||
$app.ws.onopen = function (e) {
|
$app.ws.onopen = function (e) {
|
||||||
$app.ws.send('{"method": "request", "param": "sys_status"}');
|
$app.ws.send('{"method": "request", "param": "sys_status"}');
|
||||||
|
|
Loading…
Reference in New Issue