disconnect method

Future<void> disconnect()
inherited

Disconnects from the service

Implementation

Future<void> disconnect() async {
  if (_isConnected) {
    logApp('disconnecting');
    isLoggedIn = false;
    _isConnected = false;
    isSocketClosingExpected = true;
    try {
      await _socketStreamSubscription.cancel();
    } catch (e) {
      print('unable to cancel subscription $e');
    }
    try {
      await _socket.close();
    } catch (e) {
      print('unable to close socket $e');
    }
  }
}