Skip to main content

Class: TLSSocket

A TLS client socket. Wraps a TCP connection with TLS encryption. All data read from the readable stream and written to the writable stream is automatically encrypted/decrypted — JS only sees plaintext.

Extends​

  • AsyncDisposable

Constructors​

Constructor​

new TLSSocket(remoteAddress, remotePort, options?): TLSSocket

Parameters​

remoteAddress​

string

remotePort​

number

options?​

TLSSocketOptions

Returns​

TLSSocket

Properties​

closed​

readonly closed: Promise<void>


opened​

readonly opened: Promise<TLSSocketOpenInfo>

Methods​

close()​

close(): void

Initiates close. Use closed to await full teardown.

Also async-disposable: at the end of an await using s = new TLSSocket(...) scope the socket is closed and closed is awaited.

Returns​

void