From 8f0465f57eb050e20291799e6023691154b0fb0d Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Jan 2018 17:46:38 +0530 Subject: [PATCH] [fix] socketio.js for firefox --- socketio.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/socketio.js b/socketio.js index 6999205d3a..01ba972e23 100644 --- a/socketio.js +++ b/socketio.js @@ -46,15 +46,16 @@ io.on('connection', function (socket) { return; } - - - - if (flags[sid]) { + // firefox reconnects multiple times on boot, so allow a few + // rapid reconnections + if (flags[sid] && flags[sid] > 4) { // throttle this function return; + } else { + flags[sid] = 1; } - flags[sid] = sid; + flags[sid] += 1; setTimeout(function () { flags[sid] = null; }, 10000); @@ -76,7 +77,7 @@ io.on('connection', function (socket) { return room } - + socket.on('frappe.model:subscribe', function (params) { const doctype = params.doctype const name = params.name