| // 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 DirectSockets, |
| DedicatedWorker DirectSockets, |
| SharedWorker DirectSocketsInSharedWorkers, |
| ServiceWorker DirectSocketsInServiceWorkers |
| ), |
| ActiveScriptWrappable, |
| SecureContext, |
| 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(); |
| }; |