diff --git a/README.md b/README.md index a5e42b6..86c58bf 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ var myConnection = IrcSocket({ If `capab: true` is passed to the configuration object the library will send `CAP LS` first to initiate a capabilities negotiation. -### Dependency Injection ### +### Dependency Management ### A simple irc socket uses a `net.Socket` socket by default. You can pass a seperate generic socket instead in the second parameter. @@ -120,12 +120,14 @@ This method returns the realname (also called gecos) of the connection. ## Events ## -The basic-irc-socket is an event emitter. It emits three events. +The basic-irc-socket is an event emitter. It emits five events. + ready(): Once the first 001 message has been acknowledged. + data(message: String): Every message (including the 001) from the sender (inclusive) the the newline (exclusive). + close(): Once the implementing socket has been closed. ++ timeout(): When the implementing socket times out. ++ end(): Once the implementing socket emits an 'end' event. ## Testing ## diff --git a/irc-socket.js b/irc-socket.js index 59bf0b8..ebbca0e 100644 --- a/irc-socket.js +++ b/irc-socket.js @@ -114,6 +114,14 @@ var Socket = module.exports = function Socket (network, NetSocket) { socket.emit('close'); }); + socket.impl.on('end', function () { + socket.emit('end'); + }); + + socket.impl.on('timeout', function () { + socket.emit('timeout'); + }); + socket.impl.on('data', onData); socket.impl.setEncoding('utf-8'); socket.impl.setNoDelay(); diff --git a/package.json b/package.json index 399d781..cec98a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "irc-socket", - "version": "2.0.1", + "version": "2.1.0", "description": "Simple IRC Socket for usage with IRC libraries.", "main": "irc-socket.js", "scripts": {