Class Socket

The Socket class represents a TCP connection, from which you can read and write data. A socket begins in a connected state (if the socket fails to connect, an error is thrown). While in a connected state, the socket’s ReadableStream and WritableStream can be read from and written to respectively.

Hierarchy

  • Socket

Properties

closed: Promise<void>

Methods

  • Closes the socket and its underlying connection.

    Parameters

    • Optional reason: any

    Returns Promise<void>

  • Enables opportunistic TLS (otherwise known as StartTLS) which is a requirement for some protocols (primarily postgres/mysql and other DB protocols).

    Returns Socket

Generated using TypeDoc