sendExtendedConnect method

Future<int> sendExtendedConnect(
  1. ExtendedConnectRequest request
)

Send an Extended CONNECT request (RFC 9220) on a new bidirectional stream.

Encodes the request headers with the :protocol pseudo-header and optionally stages a request body. Returns the stream ID for this exchange.

Implementation

Future<int> sendExtendedConnect(ExtendedConnectRequest request) async {
  final quic = _quicConnection as dynamic;
  final streamId = quic.openBidirectionalStream() as int;
  final headers = request.encodeHeaders(encoder: qpackEncoder);
  _sendHeaders(streamId, headers);
  if (request.body != null && request.body!.isNotEmpty) {
    _sendData(streamId, request.body!);
  }
  return streamId;
}