"use strict";


/*global nodeca, _*/


// 3rd-party
var Faye = require('faye');


////////////////////////////////////////////////////////////////////////////////


var realtime = module.exports = {
  activeClients: 0
};


////////////////////////////////////////////////////////////////////////////////


var noop = function () {};


////////////////////////////////////////////////////////////////////////////////


// attaches faye adapter to the `server`
//
realtime.attach = function attach(server, next) {
  var faye = new Faye.NodeAdapter({mount: '/faye'});

  if (process.env.FAYE_LOGLEVEL) {
    // This produces lots of logs, which are usefull
    // only during development of RT things.
    // USAGE: FAYE_LOGLEVEL=info ./fontello.js server
    Faye.Logging.logLevel = process.env.FAYE_LOGLEVEL;
  }

  // FIXME: Replace dummy active_clients inc/dec with real heartbeat/timeouts
  faye.bind('handshake',  function () { realtime.activeClients++; });
  faye.bind('disconnect', function () { realtime.activeClients--; });


  var curr_users_count = 0;
  setInterval(function () {
    if (realtime.activeClients !== curr_users_count) {
      curr_users_count = realtime.activeClients;
      faye.getClient().publish('/stats/users_online', curr_users_count);
    }
  }, 10000);


  faye.attach(server);
  next();
};

@@ -162,261 +162,8 @@
 /%0A%0A%0A
-var realtime = module.exports = %7B%0A  activeClients: 0%0A%7D;%0A%0A%0A////////////////////////////////////////////////////////////////////////////////%0A%0A%0Avar noop = function () %7B%7D;%0A%0A%0A////////////////////////////////////////////////////////////////////////////////%0A%0A%0A
 // a
@@ -202,24 +202,30 @@
 ver%60%0A//%0A
-realtime
+module.exports
 .attach 
@@ -563,482 +563,8 @@
  %7D%0A%0A
-  // FIXME: Replace dummy active_clients inc/dec with real heartbeat/timeouts%0A  faye.bind('handshake',  function () %7B realtime.activeClients++; %7D);%0A  faye.bind('disconnect', function () %7B realtime.activeClients--; %7D);%0A%0A%0A  var curr_users_count = 0;%0A  setInterval(function () %7B%0A    if (realtime.activeClients !== curr_users_count) %7B%0A      curr_users_count = realtime.activeClients;%0A      faye.getClient().publish('/stats/users_online', curr_users_count);%0A    %7D%0A  %7D, 10000);%0A%0A%0A
   fa

Remove unused code