summaryrefslogtreecommitdiffstats
path: root/webapp/actions/websocket_actions.jsx
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-03-17 16:29:26 +0000
committerGeorge Goldberg <george@gberg.me>2017-03-17 16:29:26 +0000
commit7f266c19511171f509ae8a60170de10c8d10b41e (patch)
tree04cd68ac4722313abec3ea47cc7cda229e463b1d /webapp/actions/websocket_actions.jsx
parentbfae88e60c7a623afae82e06ce1421ca778c06e7 (diff)
parent8568afe5b4fb4d26b14fbc0d21f088eaa490b314 (diff)
downloadchat-7f266c19511171f509ae8a60170de10c8d10b41e.tar.gz
chat-7f266c19511171f509ae8a60170de10c8d10b41e.tar.bz2
chat-7f266c19511171f509ae8a60170de10c8d10b41e.zip
Merge branch 'release-3.7' into master.
Diffstat (limited to 'webapp/actions/websocket_actions.jsx')
-rw-r--r--webapp/actions/websocket_actions.jsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/webapp/actions/websocket_actions.jsx b/webapp/actions/websocket_actions.jsx
index 913a89221..e36d11fde 100644
--- a/webapp/actions/websocket_actions.jsx
+++ b/webapp/actions/websocket_actions.jsx
@@ -89,6 +89,26 @@ export function reconnect(includeWebSocket = true) {
ErrorStore.emitChange();
}
+let intervalId = '';
+const SYNC_INTERVAL_MILLISECONDS = 1000 * 60 * 15; // 15 minutes
+
+export function startPeriodicSync() {
+ clearInterval(intervalId);
+
+ intervalId = setInterval(
+ () => {
+ if (UserStore.getCurrentUser() != null) {
+ reconnect(false);
+ }
+ },
+ SYNC_INTERVAL_MILLISECONDS
+ );
+}
+
+export function stopPeriodicSync() {
+ clearInterval(intervalId);
+}
+
function handleFirstConnect() {
ErrorStore.clearLastError();
ErrorStore.emitChange();