diff --git a/irc-socket.js b/irc-socket.js index 6eb0b76..c91eea6 100644 --- a/irc-socket.js +++ b/irc-socket.js @@ -105,7 +105,12 @@ var Socket = module.exports = function Socket (network, NetSocket) { socket.impl.on(emitEvent, emitWhenConnected); }(); - socket.impl.once('close', function () { + socket.impl.on('error', function () { + socket.connected = false; + socket.emit('error'); + }); + + socket.impl.on('close', function () { socket.connected = false; socket.emit('close'); }); diff --git a/package.json b/package.json index f420556..d818bb0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "irc-socket", - "version": "1.2.1", + "version": "1.3.1", "description": "Simple IRC Socket for usage with IRC libraries.", "main": "irc-socket.js", "scripts": {