meteor/livedata/server/livedata_server.js
function () {
    var self = this;

    // Already destroyed.
    if (!self.inQueue)
      return;

    if (self.heartbeat) {
      self.heartbeat.stop();
      self.heartbeat = null;
    }

    if (self.socket) {
      self.socket.close();
      self.socket._meteorSession = null;
    }

    // Drop the merge box data immediately.
    self.collectionViews = {};
    self.inQueue = null;

    Package.facts && Package.facts.Facts.incrementServerFact(
      "livedata", "sessions", -1);

    Meteor.defer(function () {
      // stop callbacks can yield, so we defer this on destroy.
      // sub._isDeactivated() detects that we set inQueue to null and
      // treats it as semi-deactivated (it will ignore incoming callbacks, etc).
      self._deactivateAllSubscriptions();

      // Defer calling the close callbacks, so that the caller closing
      // the session isn't waiting for all the callbacks to complete.
      _.each(self._closeCallbacks, function (callback) {
        callback();
      });
    });
  }
function () {
    var self = this;

    // Already destroyed.
    if (!self.inQueue)
      return;

    if (self.heartbeat) {
      self.heartbeat.stop();
      self.heartbeat = null;
    }

    if (self.socket) {
      self.socket.close();
      self.socket._meteorSession = null;
    }

    // Drop the merge box data immediately.
    self.collectionViews = {};
    self.inQueue = null;

    Package.facts && Package.facts.Facts.incrementServerFact(
      "livedata", "sessions", -1);

    Meteor.defer(function () {
      // stop callbacks can yield, so we defer this on destroy.
      // sub._isDeactivated() detects that we set inQueue to null and
      // treats it as semi-deactivated (it will ignore incoming callbacks, etc).
      self._deactivateAllSubscriptions();

      // Defer calling the close callbacks, so that the caller closing
      // the session isn't waiting for all the callbacks to complete.
      _.each(self._closeCallbacks, function (callback) {
        callback();
      });
    });
  }
function ( ) { var self = this ; // Already destroyed. if ( ! self . inQueue ) return ; if ( self . heartbeat ) { self . heartbeat . stop ( ) ; self . heartbeat = null ; } if ( self . socket ) { self . socket . close ( ) ; self . socket . _meteorSession = null ; } // Drop the merge box data immediately. self . collectionViews = { } ; self . inQueue = null ; Package . facts && Package . facts . Facts . incrementServerFact ( "livedata" , "sessions" , - 1 ) ; Meteor . defer ( function ( ) { // stop callbacks can yield, so we defer this on destroy. // sub._isDeactivated() detects that we set inQueue to null and // treats it as semi-deactivated (it will ignore incoming callbacks, etc). self . _deactivateAllSubscriptions ( ) ; // Defer calling the close callbacks, so that the caller closing // the session isn't waiting for all the callbacks to complete. _ . each ( self . _closeCallbacks , function ( callback ) { callback ( ) ; } ) ; } ) ; }
Destroy this session. Stop all processing and tear everything down. If a socket was attached, close it.
Destroy this session . Stop all processing and tear everything down . If a socket was attached close it .