diff --git a/bigbluebutton-html5/imports/utils/stats.js b/bigbluebutton-html5/imports/utils/stats.js index 36b1a2949c20713c2da25765d120daf1c3eb98b2..e558d4309f5dace2405b99839b925854aad4c8dc 100644 --- a/bigbluebutton-html5/imports/utils/stats.js +++ b/bigbluebutton-html5/imports/utils/stats.js @@ -15,11 +15,17 @@ const stop = callback => { return; }; +const isConnected = conn => { + if (conn && conn.connectionState === 'connected') return true; + + return false; +}; + const collect = (conn, callback) => { let stats = []; const monitor = (conn, stats, iteration) => { - if (!conn) return stop(callback); + if (!isConnected(conn)) return stop(callback); conn.getStats().then(results => { if (!results) return stop(callback);