From 8a1d80d5f5ba8728573cb48495416b46ea4a4d6e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 20 Sep 2016 02:32:09 +1200 Subject: Fix a problem with websocket path --- web/app/controller/Root.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'web/app/controller') 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); -- cgit v1.2.3