Handler API

webtransport.handler.connect_received(path, response_headers)

Called whenever an extended CONNECT method is received.

Parameters
  • path (str) – Value of :path pseudo header in the CONNECT method.

  • response_headers (List[Tuple[bytes, bytes]]) – The response headers which will be sent to the peer. :status is set to 200 when it isn’t specified.

Return type

None

webtransport.handler.session_established(session, path)

Called whenever a WebTransport session is established.

Parameters
Return type

None

webtransport.handler.incoming_unidirectional_stream_received(session, stream_id, data=None)

Called whenever a unidirectional WebTransport stream is received.

Parameters
  • session (WebTransportSession) – A WebTransport session object.

  • stream_id (int) – The ID of the stream.

  • data (Optional[bytes]) – The first chunk of data which was received at the same time the stream is received.

Return type

None

webtransport.handler.incoming_bidirectional_stream_received(session, stream_id, data=None)

Called whenever a bidirectional WebTransport stream is received.

Parameters
  • session (WebTransportSession) – A WebTransport session object.

  • stream_id (int) – The ID of the stream.

  • data (Optional[bytes]) – The first chunk of data which was received at the same time the stream is received.

Return type

None

webtransport.handler.stream_data_received(session, stream_id, data)

Called whenever data is received on a stream.

Parameters
  • session (WebTransportSession) – A WebTransport session object.

  • stream_id (int) – The ID of the stream the data was received for.

  • data (bytes) – The received data.

Return type

None

webtransport.handler.datagram_received(session, data)

Called whenever data is received on a WebTransport session.

Parameters
  • session (WebTransportSession) – A WebTransport session object.

  • data (bytes) – The received data.

Return type

None