code: function IncomingStream(access_token, userid, groupids) {
      this.access_token = access_token;
      this.userid = userid;
      this.groupids = groupids;
  
      this.client = new WebSocketClient();
      this.connection = null;
      this.socketId = 1;
  
      this.state = STATE_DISCONNECTED;
  
      var self = this;
  
      var connectionInitHelper = function(connection) {
  
        connection.on('close', function(reasonCode, description) {
          self.emit('status', 'Websocket Disconnected.', description);
          this.connection = null;
          self.setState(STATE_DISCONNECTED);        
        });
  
        connection.on('error', function(error) {
          self.handleError("Websocket experienced error.", error);
          self.setState(STATE_DISCONNECTED);
        })
          
        connection.on('message', function(msg) {
          if (msg.type === 'utf8' && msg.utf8Data) {
            
            self.emit('status', 'Received:', msg);
            each(JSON.parse(msg.utf8Data), function(data) {
  
              if (data["channel"] == "/meta/handshake") {
                self.handshakeResponse(data);
              } else if (data["channel"] == "/meta/subscribe") {
                self.subscribeResponse(data);
              } else {
                self.emit('message', data);
              }
  
            });
  
          } else {
            self.emit('error','Received a non-utf8 message.', msg);
          }
        });
  
        return connection;
  
      }
  
      this.client.on('connect', function(connection) {
        self.setState(STATE_PENDING);  
        self.connection = connectionInitHelper(connection);
        self.emit('status', 'Websocket Connected');
        self.handshake();
      });
  
      this.client.on('connectFailed', function(err) {
        self.setState(STATE_DISCONNECTED);
        self.connection = null;
        self.emit('error', 'Connection Failed', err);
      });
  
  
  }
docs: /*
  
  access_token [required] - your application API token for authentication purposes
  userid       [required] - your userid, used to subscribe to your push messages
  groupids     [optional] - an array of groupids to get partial updates from