jrpc.js
function call(methodName, params, next) {
  var request = {
    jsonrpc: '2.0',
    method : methodName
  };

  if (!this.active) {
    return this;
  }

  if (typeof params === 'function') {
    next = params;
    params = null;
  }

  if (
    'system._upgraded' in this.remoteComponents
    && !(methodName in this.remoteComponents)
  ) {
    // We're upgraded, yet method name isn't found, immediate error!
    if (typeof next === 'function') {
      setImmediate(next, {
        code   : -32601,
        message: 'Unknown remote method'
      });
    }
    return this;
  }

  if (typeof params === 'object') {
    request.params = params;
  }

  this.serial++;
  if (typeof next === 'function') {
    request.id = this.serial;
    this.inbox[this.serial] = next;
  }
  this.outbox.requests.push(request);

  // If we're interactive, send the new request
  this.transmit();

  if (typeof next !== 'function') {
    return this;
  }
  if (this.remoteTimeout > 0) {
    this.outTimers[this.serial] = setTimeout(
      deliverResponse.bind(
        this,
        {
          jsonrpc: '2.0',
          id     : this.serial,
          error  : {
            code   : -1000,
            message: 'Timed out waiting for response'
          }
        }
      ),
      this.remoteTimeout
    );
  } else {
    this.outTimers[this.serial] = true;  // Placeholder
  }

  return this;
}
function call(methodName, params, next) {
  var request = {
    jsonrpc: '2.0',
    method : methodName
  };

  if (!this.active) {
    return this;
  }

  if (typeof params === 'function') {
    next = params;
    params = null;
  }

  if (
    'system._upgraded' in this.remoteComponents
    && !(methodName in this.remoteComponents)
  ) {
    // We're upgraded, yet method name isn't found, immediate error!
    if (typeof next === 'function') {
      setImmediate(next, {
        code   : -32601,
        message: 'Unknown remote method'
      });
    }
    return this;
  }

  if (typeof params === 'object') {
    request.params = params;
  }

  this.serial++;
  if (typeof next === 'function') {
    request.id = this.serial;
    this.inbox[this.serial] = next;
  }
  this.outbox.requests.push(request);

  // If we're interactive, send the new request
  this.transmit();

  if (typeof next !== 'function') {
    return this;
  }
  if (this.remoteTimeout > 0) {
    this.outTimers[this.serial] = setTimeout(
      deliverResponse.bind(
        this,
        {
          jsonrpc: '2.0',
          id     : this.serial,
          error  : {
            code   : -1000,
            message: 'Timed out waiting for response'
          }
        }
      ),
      this.remoteTimeout
    );
  } else {
    this.outTimers[this.serial] = true;  // Placeholder
  }

  return this;
}
function call ( methodName , params , next ) { var request = { jsonrpc : '2.0' , method : methodName } ; if ( ! this . active ) { return this ; } if ( typeof params === 'function' ) { next = params ; params = null ; } if ( 'system._upgraded' in this . remoteComponents && ! ( methodName in this . remoteComponents ) ) { // We're upgraded, yet method name isn't found, immediate error! if ( typeof next === 'function' ) { setImmediate ( next , { code : - 32601 , message : 'Unknown remote method' } ) ; } return this ; } if ( typeof params === 'object' ) { request . params = params ; } this . serial ++ ; if ( typeof next === 'function' ) { request . id = this . serial ; this . inbox [ this . serial ] = next ; } this . outbox . requests . push ( request ) ; // If we're interactive, send the new request this . transmit ( ) ; if ( typeof next !== 'function' ) { return this ; } if ( this . remoteTimeout > 0 ) { this . outTimers [ this . serial ] = setTimeout ( deliverResponse . bind ( this , { jsonrpc : '2.0' , id : this . serial , error : { code : - 1000 , message : 'Timed out waiting for response' } } ) , this . remoteTimeout ) ; } else { this . outTimers [ this . serial ] = true ; // Placeholder } return this ; }
Client side 
Queue up a remote method call

@param {string}               methodName Name of method to call
@param {(Object|Array|null)}  [params]   Parameters
@param {JRPC~receiveCallback} [next]     Callback to receive result

@return {JRPC} This instance, for chaining
Client side Queue up a remote method call