aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web/app/Style.js2
-rw-r--r--web/app/controller/Root.js23
-rw-r--r--web/l10n/en.json1
3 files changed, 25 insertions, 1 deletions
diff --git a/web/app/Style.js b/web/app/Style.js
index e22869c..c5fce9b 100644
--- a/web/app/Style.js
+++ b/web/app/Style.js
@@ -18,6 +18,8 @@
Ext.define('Traccar.Style', {
singleton: true,
+ reconnectTimeout: 60 * 1000,
+
normalPadding: 10,
windowWidth: 640,
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index 2a20dbe..0cc2a14 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) {
diff --git a/web/l10n/en.json b/web/l10n/en.json
index f969db4..4b883c7 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -48,6 +48,7 @@
"errorTitle": "Error",
"errorUnknown": "Unknown error",
"errorConnection": "Connection error",
+ "errorSocket": "Web socket connection error",
"userEmail": "Email",
"userPassword": "Password",
"userAdmin": "Admin",