mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-11-01 18:38:03 +00:00
Use location.name instead of _server_name
This makes sure that even when there is a forward through a router, VirtualBox, an SSH tunnel, the websocket connections will go to the right place instead of simply failing.
This commit is contained in:
@@ -2606,7 +2606,7 @@ var clonos={
|
||||
wsconnect:function()
|
||||
{
|
||||
this.client_id=Math.random(10000); // поменять на сессию
|
||||
this.socket = new WebSocket("ws://"+_server_name+":8023/clonos"+location.pathname);
|
||||
this.socket = new WebSocket("ws://"+location.hostname+":8023/clonos"+location.pathname);
|
||||
$(this.socket).on('open',$.proxy(this.wsopen,this))
|
||||
.on('close',$.proxy(this.wsclose,this))
|
||||
.on('error',$.proxy(this.wserror,this))
|
||||
@@ -3251,7 +3251,7 @@ graphs={
|
||||
{
|
||||
console.log('Соединяемся по сокету');
|
||||
this.client_id=this.name;
|
||||
socket = new WebSocket("ws://"+_server_name+":8024/graph"+location.pathname+"client-"+Math.random());
|
||||
socket = new WebSocket("ws://"+location.hostname+":8024/graph"+location.pathname+"client-"+Math.random());
|
||||
$(socket).on('open',$.proxy(this.wsopen,this))
|
||||
.on('close',$.proxy(this.wsclose,this))
|
||||
.on('error',$.proxy(this.wserror,this))
|
||||
@@ -3598,4 +3598,4 @@ function ws_debug(){
|
||||
$(window).on('load',function(){clonos.start();});
|
||||
$(window).on('unload',function(){}); /* эта функция заставляет FireFox запускать JS-функции при нажатии кнопки «Назад»
|
||||
http://stackoverflow.com/questions/2638292/after-travelling-back-in-firefox-history-javascript-wont-run */
|
||||
$(function(){clonos.loadData('getJsonPage',$.proxy(clonos.onLoadData,clonos));});
|
||||
$(function(){clonos.loadData('getJsonPage',$.proxy(clonos.onLoadData,clonos));});
|
||||
|
||||
Reference in New Issue
Block a user