# handleSocketEvent method

1. @visibleForTesting

Future <void> handleSocketEvent(

1. XmppSocketEvent event

)

Called whenever the socket creates an event

## Implementation

    @visibleForTesting
    Future<void> handleSocketEvent(XmppSocketEvent event) async {
      if (event is XmppSocketErrorEvent) {
        await handleError(SocketError(event));
      } else if (event is XmppSocketClosureEvent) {
        if (!event.expected) {
          _log.fine(
            'Received unexpected XmppSocketClosureEvent. Reconnecting...',
          );
          await handleError(SocketError(XmppSocketErrorEvent(event)));
        } else {
          _log.fine(
            'Received XmppSocketClosureEvent. No reconnection attempt since _socketClosureTriggersReconnect is false...',
          );
        }
      }
    }