openQpackStreams method
Open the QPACK encoder and decoder unidirectional streams.
Sets the local decoder capacity and sends a Set Dynamic Table Capacity instruction on the encoder stream. The encoder capacity is updated when the peer's SETTINGS_QPACK_MAX_TABLE_CAPACITY is received.
Implementation
Future<void> openQpackStreams() async {
qpackDecoder.dynamicTable.setCapacity(_localSettings.maxTableCapacity);
qpackEncoder.dynamicTable.setCapacity(_localSettings.maxTableCapacity);
// Decoder stream: currently empty on open, instructions are added later.
final decoderBytes = Uint8List(0);
_decoderStreamId = await _openUnidirectionalStream(
StreamType.qpackDecoder,
decoderBytes,
);
// Encoder stream: start with a Set Dynamic Table Capacity instruction.
final capacityInstruction = SetDynamicTableCapacity(
capacity: _localSettings.maxTableCapacity,
);
final encoderBytes = capacityInstruction.serialize();
_encoderStreamId = await _openUnidirectionalStream(
StreamType.qpackEncoder,
encoderBytes,
);
}