WebTransport.webidl (3264B)
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/. */ 5 6 /* https://w3c.github.io/webtransport */ 7 8 /* https://w3c.github.io/webtransport/#web-transport-configuration */ 9 10 dictionary WebTransportHash { 11 DOMString algorithm; 12 BufferSource value; 13 }; 14 15 dictionary WebTransportOptions { 16 boolean allowPooling = false; 17 boolean requireUnreliable = false; 18 sequence<WebTransportHash> serverCertificateHashes; 19 WebTransportCongestionControl congestionControl = "default"; 20 }; 21 22 enum WebTransportCongestionControl { 23 "default", 24 "throughput", 25 "low-latency", 26 }; 27 28 /* https://w3c.github.io/webtransport/#web-transport-close-info */ 29 30 dictionary WebTransportCloseInfo { 31 unsigned long closeCode = 0; 32 UTF8String reason = ""; 33 }; 34 35 /* https://w3c.github.io/webtransport/#uni-stream-options */ 36 dictionary WebTransportSendStreamOptions { 37 long long? sendOrder = null; 38 }; 39 40 /* https://w3c.github.io/webtransport/#web-transport-stats */ 41 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; 55 }; 56 57 /* https://w3c.github.io/webtransport/#web-transport-stats%E2%91%A0 */ 58 59 dictionary WebTransportDatagramStats { 60 DOMHighResTimeStamp timestamp; 61 unsigned long long expiredOutgoing; 62 unsigned long long droppedIncoming; 63 unsigned long long lostOutgoing; 64 }; 65 66 /* https://w3c.github.io/webtransport/#web-transport */ 67 68 [Exposed=(Window,Worker), SecureContext, Pref="network.webtransport.enabled"] 69 interface WebTransport { 70 [Throws] 71 constructor(USVString url, optional WebTransportOptions options = {}); 72 73 [NewObject] 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 = {}); 80 81 [Throws] readonly attribute WebTransportDatagramDuplexStream datagrams; 82 83 [NewObject] 84 Promise<WebTransportBidirectionalStream> createBidirectionalStream( 85 optional WebTransportSendStreamOptions options = {}); 86 /* a ReadableStream of WebTransportBidirectionalStream objects */ 87 readonly attribute ReadableStream incomingBidirectionalStreams; 88 89 90 /* XXX spec says this should be WebTransportSendStream */ 91 [NewObject] 92 Promise<WritableStream> createUnidirectionalStream( 93 optional WebTransportSendStreamOptions options = {}); 94 /* a ReadableStream of WebTransportReceiveStream objects */ 95 readonly attribute ReadableStream incomingUnidirectionalStreams; 96 }; 97 98 enum WebTransportReliabilityMode { 99 "pending", 100 "reliable-only", 101 "supports-unreliable", 102 };