(options)
| 37 | */ |
| 38 | |
| 39 | constructor(options) { |
| 40 | this.#callbacks = { |
| 41 | onReadable: options.onReadable, |
| 42 | onWritable: options.onWritable, |
| 43 | onError: options.onError |
| 44 | }; |
| 45 | |
| 46 | this.#session = new Session({ |
| 47 | serverName: options.host, // serverName for SNI. This defaults it to host. Caller can override with options.secure.serverName |
| 48 | ...options.secure, |
| 49 | protocolVersion: 0x303, |
| 50 | }); |
| 51 | this.#session.initiateHandshake(); |
| 52 | |
| 53 | this.#socket = new options.TCP.io({ |
| 54 | ...options, |
| 55 | onReadable: count => this.#onReadable(count), |
| 56 | onWritable: count => this.#onWritable(count), |
| 57 | onError: () => this.#onError() |
| 58 | }); |
| 59 | this.#socket.readable = |
| 60 | this.#socket.writable = 0; |
| 61 | } |
| 62 | close() { |
| 63 | this.#socket?.close(); |
| 64 | Timer.clear(this.#doRead); |
nothing calls this directly
no test coverage detected