WebTransport: congestionControl 属性

可用性有限

此特性不是基线特性,因为它在一些最广泛使用的浏览器中不起作用。

实验性: 这是一项实验性技术
在生产中使用此技术之前,请仔细检查浏览器兼容性表格

安全上下文: 此功能仅在安全上下文(HTTPS)中可用,且支持此功能的浏览器数量有限。

注意:此功能在 Web Workers 中可用。

WebTransport 接口的只读属性 congestionControl 指示了应用程序在发送数据时偏好高吞吐量还是低延迟。

该值在 WebTransport() 构造函数选项中设置。

一个字符串,其值可能为以下之一:

default

传输的默认拥塞控制调整。这是默认值。

throughput

应用程序偏好拥塞控制针对吞吐量进行调整。

low-latency

应用程序偏好拥塞控制针对低延迟进行调整。

示例

此示例演示了如何获取 congestionControl 偏好设置。由于未在构造函数中显式设置,因此结果为 default

js
const url = "https://example.com:4999/wt";
const transport = new WebTransport(url);
console.log(transport.congestionControl); // default

规范

规范
WebTransport
# dom-webtransport-congestioncontrol

浏览器兼容性