aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-20 02:32:09 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-09-20 02:32:09 +1200
commit8a1d80d5f5ba8728573cb48495416b46ea4a4d6e (patch)
tree6f691943a8644dc0f4ec6735613573a112208fa7
parentceef6b42312751b1f0d691cbefb171599f9ffed2 (diff)
downloadetbsa-traccar-web-8a1d80d5f5ba8728573cb48495416b46ea4a4d6e.tar.gz
etbsa-traccar-web-8a1d80d5f5ba8728573cb48495416b46ea4a4d6e.tar.bz2
etbsa-traccar-web-8a1d80d5f5ba8728573cb48495416b46ea4a4d6e.zip
Fix a problem with websocket path
-rw-r--r--web/app/controller/Root.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index b5fa845..9cd6fd6 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);