lib/transport/pubnub/PubNubConnection.js
function PubNubConnection(transport, id, receive) {
  this.id = id;
  this.transport = transport;

  // ready state
  var me = this;
  this.ready = new Promise(function (resolve, reject) {
    transport.pubnub.subscribe({
      channel: id,
      message: function (message) {
        receive(message.from, message.message);
      },
      connect: function () {
        resolve(me);
      }
    });
  });
}
function PubNubConnection(transport, id, receive) {
  this.id = id;
  this.transport = transport;

  // ready state
  var me = this;
  this.ready = new Promise(function (resolve, reject) {
    transport.pubnub.subscribe({
      channel: id,
      message: function (message) {
        receive(message.from, message.message);
      },
      connect: function () {
        resolve(me);
      }
    });
  });
}
function PubNubConnection ( transport , id , receive ) { this . id = id ; this . transport = transport ; // ready state var me = this ; this . ready = new Promise ( function ( resolve , reject ) { transport . pubnub . subscribe ( { channel : id , message : function ( message ) { receive ( message . from , message . message ) ; } , connect : function ( ) { resolve ( me ) ; } } ) ; } ) ; }
A connection. The connection is ready when the property .ready resolves.
@param {PubNubTransport} transport
@param {string | number} id
@param {function} receive
@constructor
A connection . The connection is ready when the property . ready resolves .