Session

class webtransport.protocol.WebTransportSession(connection, quic, session_id)

A WebTransport session.

Parameters

quic (QuicConnection) – The QUIC connection on which this WebTransport session is established on.

close(error_code=<QuicErrorCode.NO_ERROR: 0>)

Close the session.

Parameters

error_code (int) – An error code indicating why the session is being closed.

Return type

None

async create_unidirectional_stream()

Create a unidirectional stream and return a tuple of (reader, writer).

Return type

Tuple[StreamReader, StreamWriter]

async create_bidirectional_stream()

Create a bidirectional stream and return a tuple of (reader, writer).

Return type

Tuple[StreamReader, StreamWriter]

send_stream_data(stream_id, data, end_stream=False)

Send data on the specific stream.

Parameters
  • stream_id (int) – The stream ID on which to send the data.

  • data (bytes) – The data to send.

  • end_stream (bool) – If set to True, the stream will be closed.

Return type

None

send_datagram(data)

Send data using a datagram frame.

Parameters

data (bytes) – The data to send.

Return type

None