disconnect method

Future<bool> disconnect()

Implementation

Future<bool> disconnect() async {
  Log().debug('SOCKET:: Closing connection to $url');

  try {
    // Close the channel
    if (_socket != null) {
      await _socket!.sink.close();
    }
    connected = false;
  } on Exception catch (e) {
    Log().error('SOCKET:: Error closing connection to $url. Error is $e');
  }

  Log().debug('SOCKET:: Connection Closed');

  return true;
}