# 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 PubSubNotificationEvent) {
        if (event.item.node != omemoDevicesXmlns) return;

        logger.finest('Received PubSub device notification for ${event.from}');
        final ownJid = getAttributes().getFullJID().toBare().toString();
        final jid = JID.fromString(event.from).toBare();
        final ids = event.item.payload.children
            .map((child) => int.parse(child.attributes['id']! as String))
            .toList();

        if (event.from == ownJid) {
          // Another client published to our device list node
          if (!ids.contains(await _getDeviceId())) {
            // Attempt to publish again
            unawaited(publishBundle(await _getDeviceBundle()));
          }
        } else {
          // Someone published to their device list node
          logger.finest('Got devices $ids');
        }

        // Tell the OmemoManager
        await (await _getOmemoManager()).onDeviceListUpdate(jid.toString(), ids);

        // Generate an event
        getAttributes().sendEvent(OmemoDeviceListUpdatedEvent(jid, ids));
      }
    }