How to use the net-keepalive.setKeepAliveInterval function in net-keepalive

To help you get started, we’ve selected a few net-keepalive examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nayrnet / node-hikvision-api / hikvision.js View on Github external
var client = net.connect(options, function () {
		var header =	'GET /ISAPI/Event/notification/alertStream HTTP/1.1\r\n' +
				'Host: ' + options.host + ':' + options.port + '\r\n' +
				authHeader + '\r\n' + 
				'Accept: multipart/x-mixed-replace\r\n\r\n';
		client.write(header)
		client.setKeepAlive(true,1000)
		NetKeepAlive.setKeepAliveInterval(client,5000)	// sets TCP_KEEPINTVL to 5s
		NetKeepAlive.setKeepAliveProbes(client, 12)	// 60s and kill the connection.
        	handleConnection(self, options);
	});
github SebastianOsinski / HomebridgePluginSamsungAirConditioner / lib / air-conditioner-api.js View on Github external
this.socket = tls.connect(options, function () {
            this.log('Connected');

            this.socket.setKeepAlive(this.keepAliveConfig.enabled, this.keepAliveConfig.initial_delay);
            keepAlive.setKeepAliveInterval(this.socket, this.keepAliveConfig.interval);
            keepAlive.setKeepAliveProbes(this.socket, this.keepAliveConfig.probes);

            // All responses from AC are received here as lines
            carrier.carry(this.socket, this._readLine.bind(this));
        }.bind(this));

net-keepalive

Provides high-level access to socket options like TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT

MIT
Latest version published 13 days ago

Package Health Score

78 / 100
Full package analysis