close method

void close()

Gracefully close the HTTP/3 connection.

Sends a GOAWAY frame on the control stream with the last accepted stream ID, transitions the connection to the closing state, and queues the resulting QUIC packet in pendingQuicPackets. After calling this method no new requests should be initiated.

Implementation

void close() {
  _isClosing = true;
  final goaway =
      Http3GoawayFrame(lastStreamIdOrPushId: _lastAcceptedStreamId);
  _sentGoawayFrames.add(goaway);
  unawaited(_sendGoawayFrame(goaway.toFrame().serialize()));
}