Skip to content

Commit

Permalink
2.1.0 - Pass 'end' and 'timeout' events.
Browse files Browse the repository at this point in the history
  • Loading branch information
Havvy committed Dec 30, 2013
1 parent 929d7ca commit 339dfaf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 ##
Expand Down
8 changes: 8 additions & 0 deletions irc-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 339dfaf

Please sign in to comment.