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 StreamNegotiationsDoneEvent) {
    if (event.resumed) return;

    // Cancel all waiting requests
    await _discoInfoTracker.resolveAll(
      Result<DiscoError, DiscoInfo>(UnknownDiscoError()),
    );
    await _discoItemsTracker.resolveAll(
      Result<DiscoError, List<DiscoItem>>(UnknownDiscoError()),
    );

    await _cacheLock.synchronized(() async {
      // Clear the cache
      _discoInfoCache.clear();
    });
  }
}