opstream.js
function (options) {
  var opStream = this;

  options = options || {};

  this.pingIntervalMs = options.pingIntervalMs || 5000;
  this.pingTimeoutMs = options.pingTimeoutMs || 3000;

  this.inStream = new InStream({
    maxLen: options.inMaxLen
  });

  this.outStream = new OutStream({
    retryTimeout: options.outRetryTimeout,
    maxNotAck: options.outMaxNotAck
  });

  this.inStream._send = this._send.bind(this);
  this.outStream._send = this._send.bind(this);

  this.inStream.onReadable = function () {
    if (opStream.onReadable) opStream.onReadable();
  };

  this.onReadable = null;
  this.onOnline = null;
  this.onOffline = null;

  this.lastPing = 0;

  this.connectionStatus = 'online';
  this.paused = false;

  this.timerInterval = null;
  this.pingTimeout = null;

  this.initTimer();
}
function (options) {
  var opStream = this;

  options = options || {};

  this.pingIntervalMs = options.pingIntervalMs || 5000;
  this.pingTimeoutMs = options.pingTimeoutMs || 3000;

  this.inStream = new InStream({
    maxLen: options.inMaxLen
  });

  this.outStream = new OutStream({
    retryTimeout: options.outRetryTimeout,
    maxNotAck: options.outMaxNotAck
  });

  this.inStream._send = this._send.bind(this);
  this.outStream._send = this._send.bind(this);

  this.inStream.onReadable = function () {
    if (opStream.onReadable) opStream.onReadable();
  };

  this.onReadable = null;
  this.onOnline = null;
  this.onOffline = null;

  this.lastPing = 0;

  this.connectionStatus = 'online';
  this.paused = false;

  this.timerInterval = null;
  this.pingTimeout = null;

  this.initTimer();
}
function ( options ) { var opStream = this ; options = options || { } ; this . pingIntervalMs = options . pingIntervalMs || 5000 ; this . pingTimeoutMs = options . pingTimeoutMs || 3000 ; this . inStream = new InStream ( { maxLen : options . inMaxLen } ) ; this . outStream = new OutStream ( { retryTimeout : options . outRetryTimeout , maxNotAck : options . outMaxNotAck } ) ; this . inStream . _send = this . _send . bind ( this ) ; this . outStream . _send = this . _send . bind ( this ) ; this . inStream . onReadable = function ( ) { if ( opStream . onReadable ) opStream . onReadable ( ) ; } ; this . onReadable = null ; this . onOnline = null ; this . onOffline = null ; this . lastPing = 0 ; this . connectionStatus = 'online' ; this . paused = false ; this . timerInterval = null ; this . pingTimeout = null ; this . initTimer ( ) ; }
/*
OpStream
/ * OpStream