src/kad/rpc.js
function RPC (contact, options) {
  assert(this instanceof RPC, 'Invalid instance supplied')
  assert(contact instanceof Contact, 'Invalid contact was supplied')

  events.EventEmitter.call(this)

  options = options || {}

  if (options.replyto) {
    assert(options.replyto instanceof Contact, 'Invalid contact was supplied')
  }

  this._hooks = {
    before: {},
    after: {}
  }
  this._pendingCalls = {}
  this._contact = options.replyto || contact
  this._log = options && options.logger
  this.readyState = 0

  this.open()
}
function RPC (contact, options) {
  assert(this instanceof RPC, 'Invalid instance supplied')
  assert(contact instanceof Contact, 'Invalid contact was supplied')

  events.EventEmitter.call(this)

  options = options || {}

  if (options.replyto) {
    assert(options.replyto instanceof Contact, 'Invalid contact was supplied')
  }

  this._hooks = {
    before: {},
    after: {}
  }
  this._pendingCalls = {}
  this._contact = options.replyto || contact
  this._log = options && options.logger
  this.readyState = 0

  this.open()
}
Represents an RPC interface
@constructor
@param {Contact} contact - Your node's {@link Contact} information
@param {Object} options
@param {Contact} options.replyto - Optional alternate public contact
@param {Logger} options.logger - Logger instance to use
@property {Number} readyState - Closed: 0, Transitioning: 1, Open: 2