The close() method of the WebTransport interface closes an ongoing WebTransport session.
Note: This feature is available in Web Workers
The close() method of the WebTransport interface closes an ongoing WebTransport session.
Note: This feature is available in Web Workers
js
close(info)
undefined.
WebTransportErrorThrown if close() is invoked while the WebTransport is in the process of connecting.
js
const url = "https://example.com:4999/wt"; // Initialize transport connection const transport = new WebTransport(url); // ... transport.close({ closeCode: 017, reason: "CloseButtonPressed", });
| Specification | 
|---|
| WebTransport  # dom-webtransport-close  | 
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
close | 
97 | 97 | 114 | No | 83 | No | 97 | 97 | 114 | 68 | No | 18.0 | 
    © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
    https://developer.mozilla.org/en-US/docs/Web/API/WebTransport/close