close method

void close()

Close the WebSocket connection

Implementation

void close() {
  _connectGeneration++;
  cleanPingIntervals();
  final socket = _socket;
  _socket = null;
  if (socket != null) {
    unawaited(socket.close());
  }
}