UNPKG

@boringnode/transmit

Version:

A framework agnostic Server-Sent-Event library

28 lines (27 loc) 715 B
import { Socket as NodeSocket } from 'node:net'; export class Socket extends NodeSocket { #keepAlive = false; #noDelay = false; #timeout = 0; getKeepAlive() { return this.#keepAlive; } getNoDelay() { return this.#noDelay; } getTimeout() { return this.#timeout; } setKeepAlive(enable, initialDelay) { this.#keepAlive = enable === true; return super.setKeepAlive(enable, initialDelay); } setNoDelay(noDelay) { this.#noDelay = noDelay === true; return super.setNoDelay(noDelay); } setTimeout(timeout, callback) { this.#timeout = timeout; return super.setTimeout(timeout, callback); } }