API reference
Preparing search index…

TcpSocket

TCP socket supporting raw bytes, SFML Packet framing, and TLS upgrades.

Type hierarchy

Hierarchy (View Summary)

Source & inheritance
Member directory39

Constructors

Properties

Methods

Constructors

Properties

blocking: boolean = true
Source & inheritance
detach?: () => void

Remove event listeners from the current transport.

Source & inheritance
epoch: number = 0
Source & inheritance
failure?: Error
Source & inheritance
transport?: Socket

Underlying TCP or TLS socket.

Source & inheritance
AnyPort: 0

Let the system assign an available port when binding.

Source & inheritance
Status: typeof SocketStatus = SocketStatus

Socket operation status enumeration.

Source & inheritance
TlsStatus: typeof TlsStatus = TlsStatus

TLS handshake status enumeration.

Source & inheritance
Type: typeof SocketType = SocketType

Socket transport protocol enumeration.

Source & inheritance

Methods

  • Parameters

    check
    () => boolean
    generation
    number

    Returns

    Promise<boolean>
    Source & inheritance
  • Close the current transport and wake waits from the previous generation. Repeated calls are safe; the blocking flag is unchanged.

    Returns

    void
    Source & inheritance
  • Close the connection immediately and clear pending packet transfer state.

    Returns

    void
    Source & inheritance
  • Return the cipher suite name negotiated during the handshake, or undefined before TLS completes.

    Returns

    undefined | string
    Source & inheritance
  • Return the latest underlying error, or undefined if none is recorded.

    Returns

    undefined | Error
    Source & inheritance
  • Clear frame parsing, TLS, and send snapshots on recreation; the base-class generation mechanism cancels old waits.

    Returns

    void
    Source & inheritance
  • Integrate the handle allocated or adopted by protected create into TCP send/receive and readiness state.

    Returns

    void
    Source & inheritance
  • Set whether to wait asynchronously for readability/writability. When false, return NotReady or Partial according to current queue state.

    Parameters

    blocking
    boolean

    Returns

    void
    Source & inheritance
  • Upgrade an idle connection to a TLS client with verification enabled by default; CA bytes may use PEM or DER.

    Parameters

    hostname
    string
    verifyOrCa
    string | boolean | Uint8Array = true

    Returns

    Promise<TlsStatus>
    Source & inheritance
  • Upgrade to a TLS server using a PEM/DER certificate and private key; password bytes retain their raw contents and subview bounds.

    Parameters

    certificate
    string | Uint8Array
    key
    string | Uint8Array
    password
    string | Uint8Array = ''

    Returns

    Promise<TlsStatus>
    Source & inheritance

Symbol members

"[socketEvents]": EventEmitter<DefaultEventMap> = ...
Source & inheritance
  • Let listeners adopt accepted connections through the same lifecycle.

    Parameters

    socket
    Socket

    Returns

    void
    Source & inheritance

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0