diff options
Diffstat (limited to 'web/app/controller/Root.js')
-rw-r--r-- | web/app/controller/Root.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index b5fa8450..9cd6fd6d 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -108,9 +108,10 @@ Ext.define('Traccar.controller.Root', { }, asyncUpdate: function (first) { - var protocol, socket, self = this; + var protocol, pathname, socket, self = this; protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - socket = new WebSocket(protocol + '//' + window.location.host + window.location.pathname + 'api/socket'); + pathname = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/') + 1); + socket = new WebSocket(protocol + '//' + window.location.host + pathname + 'api/socket'); socket.onclose = function (event) { self.asyncUpdate(false); |