# onXmppEvent method

1. @override

Future <void> onXmppEvent(

1. XmppEvent event

)
override

Called when XmppConnection triggers an event

## Implementation

    @override
    Future<void> onXmppEvent(XmppEvent event) async {
      if (event is StreamResumedEvent) {
        _enableStreamManagement();

        await _ackLock.synchronized(() async {
          _pendingAcks = 0;
        });

        await onStreamResumed(event.h);
      } else if (event is StreamManagementEnabledEvent) {
        _enableStreamManagement();

        await _ackLock.synchronized(() async {
          _pendingAcks = 0;
        });

        await setState(
          StreamManagementState(
            0,
            0,
            streamResumptionId: event.id,
            streamResumptionLocation: event.location,
          ),
        );
      } else if (event is ConnectingEvent) {
        _disableStreamManagement();
        _streamResumed = false;
      } else if (event is ConnectionStateChangedEvent) {
        switch (event.state) {
          case XmppConnectionState.connected:
            // Push out all pending stanzas
            if (!_streamResumed) {
              await _resendStanzas();
            }
            break;
          case XmppConnectionState.error:
          case XmppConnectionState.notConnected:
            _stopAckTimer();
            break;
          case XmppConnectionState.connecting:
            _stopAckTimer();
            // NOOP
            break;
        }
      }
    }