-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Adding the rest of WebTransport into Kestrel #42097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the rest of WebTransport into Kestrel #42097
Conversation
Start a webtransport connection
Supported JS client operations
let CERTIFICATE = ""; // TODO UPDATE THIS to the certificate hash that the sample app prints out
let encoder = new TextEncoder('utf-8');
let transport = new WebTransport("https://127.0.0.1:5007", {
serverCertificateHashes:[
{
algorithm: "sha-256",
value: Uint8Array.from(atob(CERTIFICATE), c => c.charCodeAt(0))
}]
})
await transport.ready;
const stream1 = await transport.createUnidirectionalStream();
const writer1 = stream1.getWriter();
writer1.write(new Uint8Array([65, 66, 67, 68, 69, 70, 71, 72, 73, 74]));
const stream2 = await transport.createBidirectionalStream();
const writer2 = stream2.writable.getWriter();
writer2.write(new Uint8Array([66, 67, 68, 69, 70, 71, 72, 73, 74, 75]));
const streamReader = await transport.incomingUnidirectionalStreams.getReader();
const streamResult = await reader.read();
const stream = streamResult.value;
const reader1 = stream1.getReader();
await reader1.read();
const reader2 = stream2.readable.getReader();
await reader2.read(); |
…ple so server reacts to some particular messages
@Daniel-Genkin-MS-2, this change will be considered for inclusion in the blog post for the release it'll ship in. Nice work! Please ensure that the original comment in this thread contains a clear explanation of what the change does, why it's important (what problem does it solve?), and, if relevant, include things like code samples and/or performance numbers. This content may not be exactly what goes into the blog post, but it will help the team putting together the announcement. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to try out the samples, but don't wait on me.
src/Servers/Kestrel/samples/WebTransportInteractiveSampleApp/wwwroot/index.html
Outdated
Show resolved
Hide resolved
Co-authored-by: Aditya Mandaleeka <adityamandaleeka@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor comments left. Great job!
src/Servers/Kestrel/Core/src/Internal/Http3/Http3ControlStream.cs
Outdated
Show resolved
Hide resolved
…aniel-Genkin-MS-2/aspnetcore into t-dagenkin/WebTransport-part-2
This is step two in my implementation of WebTransport support in Kestrel. This PR makes WebTransport functional and will provide a basic API for using it. Step three will be integration tests and maybe adding more features.
Goals of the PR
This PR builds upon my previous one (#41877 ) to add an API that interfaces with the existing Http3 layer in Kestrel and allows the application layer to:
Non-Goals of this PR
Non-goals are tracked in #42788
Inadvertent results of the PR
#42097 (comment)
How to use:
C#: https://github.com/dotnet/aspnetcore/blob/c5e66c255c0254a9be191ee53031cec6b79def48/docs/WebTransport.md
JS: #42097 (comment)
OR
Use the interactive sample called
WebTransportInteractiveSample
in src\Middleware\WebTransport\samples\WebTransportInteractiveSampleAppContributes to: #39583