Description
Current Solution for WebTransport
The Solution for WebTransport wraps the server::Connection
in a Mutex to allow listening to incoming streams (uni and bidi) and also to open new steams.
h3/h3-webtransport/src/server.rs
Lines 44 to 56 in 9b02824
Additional resources like new Settings, Streams, Frames or Protocols for the :protocol
pseudo header are defined and parsed within h3 itself and not h3-webtransport.
webtransport frames for example are atm handled in the h3 core.
Lines 86 to 94 in 9b02824
So new extensions require changes in h3 itself, which can become very complicated.
A few references: #236 #273
Loose thoughts about what features such an extension API might require
An Extension API IMO should have the following features:
- Ability to send custom Settings, Streams, Frames and Protocols for the
:protocol
pseudo header - Ability to react to custom Settings, Streams, Frames and Protocols for the
:protocol
pseudo header - Acces to the Quic types which implement h3-quic traits and potentially acces to some lower level structs like
FrameStream
orBufRecvStream
Some loose ideas
I have a few ideas on how this could be achieved, but nothing completely thought through.
Give another generic Parameter to the h3 connection
An additional generic Parameter could be added to ConnectionInner
(or maybe client::Connection
/ server::Connection
directly?).
This generic Parameter could either be:
- A custom Trait defined in h3 where each each "event" is a method
Fn(Args) -> () + Clone
. WithArgs
as an Enum with a variant for each "event"
When specific events occur while polling the the connection, the extension could react for example to the event when a unknown stream or frame is received.
When using traits this could be combined with custom types for custom Settings, Streams, Frames, etc.
Access to low level types in order to start streams and send.
Open Question
- Where should the CONNECT Request be handled? h3? extension? user?
Whats next
- please share your thoughts on this
- figure out more details (maybe while implementing a prototype)