1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* https://w3c.github.io/webtransport */
8 /* https://w3c.github.io/webtransport/#web-transport-configuration */
10 dictionary WebTransportHash {
15 dictionary WebTransportOptions {
16 boolean allowPooling = false;
17 boolean requireUnreliable = false;
18 sequence<WebTransportHash> serverCertificateHashes;
19 WebTransportCongestionControl congestionControl = "default";
22 enum WebTransportCongestionControl {
28 /* https://w3c.github.io/webtransport/#web-transport-close-info */
30 dictionary WebTransportCloseInfo {
31 unsigned long closeCode = 0;
32 UTF8String reason = "";
35 /* https://w3c.github.io/webtransport/#uni-stream-options */
36 dictionary WebTransportSendStreamOptions {
37 long long? sendOrder = null;
40 /* https://w3c.github.io/webtransport/#web-transport-stats */
42 dictionary WebTransportStats {
43 DOMHighResTimeStamp timestamp;
44 unsigned long long bytesSent;
45 unsigned long long packetsSent;
46 unsigned long long packetsLost;
47 unsigned long numOutgoingStreamsCreated;
48 unsigned long numIncomingStreamsCreated;
49 unsigned long long bytesReceived;
50 unsigned long long packetsReceived;
51 DOMHighResTimeStamp smoothedRtt;
52 DOMHighResTimeStamp rttVariation;
53 DOMHighResTimeStamp minRtt;
54 WebTransportDatagramStats datagrams;
57 /* https://w3c.github.io/webtransport/#web-transport-stats%E2%91%A0 */
59 dictionary WebTransportDatagramStats {
60 DOMHighResTimeStamp timestamp;
61 unsigned long long expiredOutgoing;
62 unsigned long long droppedIncoming;
63 unsigned long long lostOutgoing;
66 /* https://w3c.github.io/webtransport/#web-transport */
68 [Exposed=(Window,Worker), SecureContext, Pref="network.webtransport.enabled"]
69 interface WebTransport {
71 constructor(USVString url, optional WebTransportOptions options = {});
74 Promise<WebTransportStats> getStats();
75 readonly attribute Promise<undefined> ready;
76 readonly attribute WebTransportReliabilityMode reliability;
77 readonly attribute WebTransportCongestionControl congestionControl;
78 readonly attribute Promise<WebTransportCloseInfo> closed;
79 [Throws] undefined close(optional WebTransportCloseInfo closeInfo = {});
81 [Throws] readonly attribute WebTransportDatagramDuplexStream datagrams;
84 Promise<WebTransportBidirectionalStream> createBidirectionalStream(
85 optional WebTransportSendStreamOptions options = {});
86 /* a ReadableStream of WebTransportBidirectionalStream objects */
87 readonly attribute ReadableStream incomingBidirectionalStreams;
90 /* XXX spec says this should be WebTransportSendStream */
92 Promise<WritableStream> createUnidirectionalStream(
93 optional WebTransportSendStreamOptions options = {});
94 /* a ReadableStream of WebTransportReceiveStream objects */
95 readonly attribute ReadableStream incomingUnidirectionalStreams;
98 enum WebTransportReliabilityMode {
101 "supports-unreliable",