handleSessionEvent method

  1. @protected
FutureOr<void> handleSessionEvent(
  1. SessionEvent event
)
inherited

Handle a SessionEvent from one of this host's sessions.

The base handles the events every mode shares (SessionEventType). Overrides deal with their own protocol's events first and forward the rest with super.handleSessionEvent(event).

Implementation

@protected
// `async` lets one switch return both void and Future handlers.
// ignore: unnecessary_async
FutureOr<void> handleSessionEvent(SessionEvent event) async {
  if (event is SessionEventGeneric) {
    switch (event.type) {
      case SessionEventType.error:
        return handleSessionEventError(event);

      case SessionEventType.pingReceived:
        return handleSessionEventPingReceived(event);

      case SessionEventType.disconnected:
        return handleSessionEventDisconnected(event);
    }
  }
}