From ce5db9a9c6510c6bb00a11364325efbda7acc4a5 Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <blacklight86@gmail.com>
Date: Mon, 9 Apr 2018 23:21:19 +0200
Subject: [PATCH] Reconnect to the websocket immediately in case of normal
 closure

---
 platypush/backend/http/static/js/application.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/platypush/backend/http/static/js/application.js b/platypush/backend/http/static/js/application.js
index b2562c2b7..c61ef289c 100644
--- a/platypush/backend/http/static/js/application.js
+++ b/platypush/backend/http/static/js/application.js
@@ -33,7 +33,8 @@ $(document).ready(function() {
             console.log('Websocket closed, code: ' + event.code);
             websocketReconnectInterval = setInterval(function() {
                 initWebsocket();
-            }, 5000);
+            }, event.code == 1000 ? 10 : 5000);  // Reconnect immediately in case of normal websocket closure
+                                                 // otherwise wait 5 seconds
         };
     };