Skip to content
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

feat(unstable): WebTransport #27431

Merged
merged 1 commit into from
Jan 29, 2025
Merged

feat(unstable): WebTransport #27431

merged 1 commit into from
Jan 29, 2025

Conversation

devsnek
Copy link
Member

@devsnek devsnek commented Dec 20, 2024

Initial implementation of WebTransport client and server!

This is very unstable because the interface should eventually shift to use hyper (h3 is on the 2025 roadmap) instead of manually messing with the the protocol, which will enable integration with Deno.serveHttp/etc and allow WebTransport over h2. This will also let us expose multiplexing.

WebTransport stats will be a followup due to their complexity.

Fixes: #9017

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take a deeper look after holiday break.

Can you please open a PR to https://github.com/mdn/browser-compat-data that adds proper information about Deno having this API supported?

Comment on lines +722 to +974
pub(crate) mod webtransport {
// MIT License
//
// Copyright (c) 2023 Luke Curley
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to vendor this code? If so can you please add a link here to the original code?

Copy link
Member Author

@devsnek devsnek Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is part of web-transport-quinn but not exposed as public interface so i had to copy out the parts relying on the underlying web-transport-proto. this should only be temporary though, all this code will be replaced when hyper+h3 is ready.

@devsnek devsnek force-pushed the webtransport branch 5 times, most recently from cd50d29 to 6f7e537 Compare January 9, 2025 09:30
@devsnek devsnek force-pushed the webtransport branch 2 times, most recently from 2b1fb7d to ad87d6f Compare January 20, 2025 14:01
@bartlomieju bartlomieju added this to the 2.2.0 milestone Jan 26, 2025
Comment on lines +319 to +323
static {
webtransportConnect = async function webtransportConnect(conn, url) {
const {
0: connectTxRid,
1: connectRxRid,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I fully grasp this - why are these two functions created in a static block of a class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they access a private field

ext/web/webtransport.js Outdated Show resolved Hide resolved

let datagram;
try {
datagram = await conn.readDatagram();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this one be unrefed? Won't it cause leaks in tests?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the connection is closed, this raises. so it breaks the loop. test does not detect any leaks.

tests/specs/run/webtransport/main.ts Outdated Show resolved Hide resolved
@devsnek devsnek force-pushed the webtransport branch 2 times, most recently from 028d5e0 to 77ce66f Compare January 28, 2025 22:12
@devsnek devsnek enabled auto-merge (squash) January 29, 2025 12:14
@devsnek devsnek merged commit 0098fdd into main Jan 29, 2025
18 checks passed
@devsnek devsnek deleted the webtransport branch January 29, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement WebTransport (QUICTransport) API
2 participants