destroy method

Future<void> destroy()

Close the websocket connection.

Implementation

Future<void> destroy() async {
  _doNotReconnect = true;
  _cancelQueuedReconnect();
  _pingTimer?.cancel();
  _pingTimer = null;
  await channel.sink.close(status.normalClosure);
  await _channelSubscription?.cancel();
  _channelSubscription = null;
  await _streamController.close();
}