disconnect method

Future<ConnectionResponse> disconnect({
  1. Duration? timeout,
})
override

timeout: milliseconds to wait after closing the socket

Implementation

Future<ConnectionResponse> disconnect({Duration? timeout}) async {
  await socket?.flush();
  await socket?.close();
  this.isConnected = false;
  if (timeout != null) {
    await Future.delayed(timeout, () => null);
  }
  return ConnectionResponse.success;
}