aboutsummaryrefslogtreecommitdiff
path: root/web/app/controller/Root.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/controller/Root.js')
-rw-r--r--web/app/controller/Root.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 2a20dbe3..0cc2a148 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -130,7 +130,28 @@ Ext.define('Traccar.controller.Root', {
socket = new WebSocket(protocol + '//' + window.location.host + pathname + 'api/socket');
socket.onclose = function (event) {
- self.asyncUpdate(false);
+ Ext.toast(Strings.errorSocket, Strings.errorTitle, 'br');
+
+ Ext.Ajax.request({
+ url: 'api/devices',
+ success: function(response) {
+ self.updateDevices(Ext.decode(response.responseText));
+ }
+ });
+
+ Ext.Ajax.request({
+ url: 'api/positions',
+ headers: {
+ Accept: 'application/json'
+ },
+ success: function(response) {
+ self.updatePositions(Ext.decode(response.responseText));
+ }
+ });
+
+ setTimeout(function() {
+ self.asyncUpdate(false);
+ }, Traccar.Style.reconnectTimeout);
};
socket.onmessage = function (event) {