mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
feat(unstable): WebTransport (#27431)
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](https://hyper.rs/contrib/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: https://github.com/denoland/deno/issues/9017
This commit is contained in:
parent
7528c7909c
commit
0098fddb10
18 changed files with 1945 additions and 13 deletions
|
@ -34,6 +34,7 @@ import * as telemetry from "ext:deno_telemetry/telemetry.ts";
|
|||
const { ObjectDefineProperties } = primordials;
|
||||
|
||||
const loadQuic = core.createLazyLoader("ext:deno_net/03_quic.js");
|
||||
const loadWebTransport = core.createLazyLoader("ext:deno_web/webtransport.js");
|
||||
|
||||
const denoNs = {
|
||||
Process: process.Process,
|
||||
|
@ -198,6 +199,10 @@ ObjectDefineProperties(denoNsUnstableById[unstableIds.net], {
|
|||
loadQuic,
|
||||
),
|
||||
QuicIncoming: core.propWritableLazyLoaded((q) => q.QuicIncoming, loadQuic),
|
||||
upgradeWebTransport: core.propWritableLazyLoaded(
|
||||
(wt) => wt.upgradeWebTransport,
|
||||
loadWebTransport,
|
||||
),
|
||||
});
|
||||
|
||||
// denoNsUnstableById[unstableIds.unsafeProto] = { __proto__: null }
|
||||
|
|
|
@ -39,6 +39,7 @@ import * as webgpuSurface from "ext:deno_webgpu/02_surface.js";
|
|||
import { unstableIds } from "ext:runtime/90_deno_ns.js";
|
||||
|
||||
const loadImage = core.createLazyLoader("ext:deno_canvas/01_image.js");
|
||||
const loadWebTransport = core.createLazyLoader("ext:deno_web/webtransport.js");
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope
|
||||
const windowOrWorkerGlobalScope = {
|
||||
|
@ -298,6 +299,34 @@ unstableForWindowOrWorkerGlobalScope[unstableIds.broadcastChannel] = {
|
|||
unstableForWindowOrWorkerGlobalScope[unstableIds.net] = {
|
||||
WebSocketStream: core.propNonEnumerable(webSocketStream.WebSocketStream),
|
||||
WebSocketError: core.propNonEnumerable(webSocketStream.WebSocketError),
|
||||
WebTransport: core.propNonEnumerableLazyLoaded(
|
||||
(wt) => wt.WebTransport,
|
||||
loadWebTransport,
|
||||
),
|
||||
WebTransportBidirectionalStream: core.propNonEnumerableLazyLoaded(
|
||||
(wt) => wt.WebTransportBidirectionalStream,
|
||||
loadWebTransport,
|
||||
),
|
||||
WebTransportDatagramDuplexStream: core.propNonEnumerableLazyLoaded(
|
||||
(wt) => wt.WebTransportDatagramDuplexStream,
|
||||
loadWebTransport,
|
||||
),
|
||||
WebTransportReceiveStream: core.propNonEnumerableLazyLoaded(
|
||||
(wt) => wt.WebTransportReceiveStream,
|
||||
loadWebTransport,
|
||||
),
|
||||
WebTransportSendGroup: core.propNonEnumerableLazyLoaded(
|
||||
(wt) => wt.WebTransportSendGroup,
|
||||
loadWebTransport,
|
||||
),
|
||||
WebTransportSendStream: core.propNonEnumerableLazyLoaded(
|
||||
(wt) => wt.WebTransportSendStream,
|
||||
loadWebTransport,
|
||||
),
|
||||
WebTransportError: core.propNonEnumerableLazyLoaded(
|
||||
(wt) => wt.WebTransportError,
|
||||
loadWebTransport,
|
||||
),
|
||||
};
|
||||
|
||||
unstableForWindowOrWorkerGlobalScope[unstableIds.webgpu] = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue