Sha256: c4fd6ba1ea21c839af94a2076bb43571f61dccc679c29ccf2ac4f514a394734a

Contents?: true

Size: 1.21 KB

Versions: 26

Compression:

Stored size: 1.21 KB

Contents

/*** = 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 ){
    
    // gets the HValue represented by
    // sesTimeoutValueId (:client_time in server)
    this.sesTimeoutValue = this.getValueById(_sesTimeoutValueId);
    this.timeoutSecs = _timeoutSecs;
    
    // onIdle is called when HSystem's ticker count % 100 == 0
    // this means it's 5 seconds with HSystemTickerInterval 50
    this.base(10, 'SesWatcher'); 
    
  },
  
  // Tells the server the client's current time
  onIdle: function(){
    var now = new Date().getTime();
    if((now - this.sesTimeoutValue.value) > this.timeoutSecs ){
      this.sesTimeoutValue.set( now );
    }
  }
});

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
rsence-pre-3.0.0.16 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.15 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.14 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.12 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.11 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.10 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.9 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.8 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.7 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.6 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.5 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.4 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.3 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.2 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.1 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-3.0.0.0 client/js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.3.0.26 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.3.0.25 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.3.0.24 js/comm/sessionwatcher/sessionwatcher.js
rsence-pre-2.3.0.23 js/comm/sessionwatcher/sessionwatcher.js