chromium/third_party/blink/renderer/modules/direct_sockets/udp_socket.idl

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://github.com/WICG/direct-sockets/blob/main/docs/explainer.md#udp

[
    Exposed=(Window,DedicatedWorker),
    ActiveScriptWrappable,
    SecureContext,
    RuntimeEnabled=DirectSockets,
    IsolatedContext
] interface UDPSocket {
  [CallWith=ScriptState, RaisesException, MeasureAs=UDPSocketConstructor]
  constructor(UDPSocketOptions options);

  [CallWith=ScriptState, MeasureAs=UDPSocketOpenedAttribute]
  readonly attribute Promise<UDPSocketOpenInfo> opened;
  [CallWith=ScriptState, MeasureAs=UDPSocketClosedAttribute]
  readonly attribute Promise<undefined> closed;

  [CallWith=ScriptState, RaisesException, MeasureAs=UDPSocketCloseFunction]
  Promise<undefined> close();
};