Created
August 7, 2012 05:49
-
-
Save heapwolf/3282080 to your computer and use it in GitHub Desktop.
tcp/keepalive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var timeout = 30000; // a half minute | |
var debug = false; | |
if (debug) { | |
socket.setKeepAlive(true, timeout); | |
} | |
else { | |
socket.setKeepAlive(true); | |
} | |
socket.on('timeout', function() { | |
socket.write('idle timeout, disconnecting, bye!'); | |
socket.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment