From e7f9b082fcb45a9714469dccff331dbf5ca49c91 Mon Sep 17 00:00:00 2001 From: damienroelens Date: Fri, 16 Jan 2015 16:03:17 +0100 Subject: [PATCH] Update client.js to add a new function. I've added a "close" function to control the moment when you want to close the TCP Connection. --- lib/client.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/client.js b/lib/client.js index b711e80..f033eae 100644 --- a/lib/client.js +++ b/lib/client.js @@ -81,6 +81,11 @@ Client.prototype.start = function() { } }; +Client.prototype.close = function(){ + var self = this; + self._client.destroy(); +} + Client.prototype.send = function(msg, end, cb) { if (typeof end === 'function') { cb = end;