Firefox Tomorrow

web api instance method

WebTransport: close() method

View on MDN ↗

Secure context Available in workers

The close() method of the WebTransport interface closes an ongoing WebTransport session.

Syntax

close(info)

Parameters

  • info Optional
    • : An object containing the following properties:
      • closeCode
        • : A number representing the error code for the error.
      • reason
        • : A string representing the reason for closing the WebTransport.

Return value

undefined.

Exceptions

  • WebTransportError
    • : Thrown if close() is invoked while the WebTransport is in the process of connecting.

Examples

const url = "https://example.com:4999/wt";
// Initialize transport connection
const transport = new WebTransport(url);

// …

transport.close({
  closeCode: 17,
  reason: "CloseButtonPressed",
});

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also