code: function updateState(newState, data) {
        var prevState = self.state;
        self.state = newState;
  
        // Only emit when the state changes
        if (prevState !== newState) {
          Pusher.debug('State changed', prevState + ' -> ' + newState);
          self.emit('state_change', {previous: prevState, current: newState});
          self.emit(newState, data);
        }
      }
docs: Updates the public state information exposed by connection  This is distinct from the internal state information used by _machine to manage the connection