Sha256: ac87e0e54814aa952c5055f12acac7f46f3ba1d6472adf74e05422bd256a9cf3

Contents?: true

Size: 1.43 KB

Versions: 34

Compression:

Stored size: 1.43 KB

Contents

/*   RSence
 *   Copyright 2009 Riassence Inc.
 *   http://riassence.com/
 *
 *   You should have received a copy of the GNU General Public License along
 *   with this software package. If not, contact licensing@riassence.com
 */


/*** = Description
  ** The single instance of this class is constructed after the first
  ** handshake request with the server by the 'main' plugin.
  **
  ** It has dual functionality:
  ** - It tells the the client time.
  **   It's available as the server HValue instance
  **   +msg.session[:main][:client_time]+ from
  **   any Plugin instance.
  ** - It polls the server on regular intervals.
  **   The polling interval is defined by the server
  **   as the _timeoutSecs constructor parameter.
  **
***/
//var//RSence.COMM
COMM.SessionWatcher = HApplication.extend({
  constructor: function( _timeoutSecs, _sesTimeoutValueId ){
    
    // onIdle is called when HSystem's ticker count % 100 == 0
    // this means it's 5 seconds with HSystemTickerInterval 50
    this.base(10, 'SesWatcher'); 
    
    // gets the HValue represented by
    // sesTimeoutValueId (:client_time in server)
    this.sesTimeoutValue = COMM.Values.values[_sesTimeoutValueId];
    this.timeoutSecs = _timeoutSecs;
  },
  
  // Tells the server the client's current time
  onIdle: function(){
    if((new Date().getTime() - this.sesTimeoutValue.value) > this.timeoutSecs ){
      this.sesTimeoutValue.set( new Date().getTime() );
    }
  }
});

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
rsence-2.1.3 js/comm/sessionwatcher/sessionwatcher.js
rsence-2.1.2 js/comm/sessionwatcher/sessionwatcher.js
rsence-2.1.1 js/comm/sessionwatcher/sessionwatcher.js
rsence-2.1.0 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.21 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.20 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.19 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.18 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.17 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.16 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.15 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.14 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.13 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.12 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.11 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.10 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.9 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.8.pre js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.7.pre js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.1.0.6.pre js/comm/sessionwatcher/sessionwatcher.js