chromium/third_party/blink/renderer/modules/direct_sockets/tcp_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#tcp

[
    Exposed=(Window,DedicatedWorker),
    ActiveScriptWrappable,
    SecureContext,
    RuntimeEnabled=DirectSockets,
    IsolatedContext
] interface TCPSocket {
  [CallWith=ScriptState, RaisesException, MeasureAs=TCPSocketConstructor]
  constructor(DOMString remoteAddress, unsigned short remotePort, optional TCPSocketOptions options = {});

  [CallWith=ScriptState, MeasureAs=TCPSocketOpenedAttribute]
  readonly attribute Promise<TCPSocketOpenInfo> opened;
  [CallWith=ScriptState, MeasureAs=TCPSocketClosedAttribute]
  readonly attribute Promise<undefined> closed;

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