Skip to content

Commit

Permalink
more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
pgte committed Oct 11, 2010
1 parent d476059 commit 84b8f75
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.markdown
Expand Up @@ -22,4 +22,20 @@ The client can send you chunks of lines and carrier will only notify you on each
});
server.listen(port);



You can also listen to the "line" event on the returned object of carrier.carry() like this:

var net = require('net'),
carrier = require('carrier');

var server;
var port = 4001;
var expected_line = "Hello World"

server = net.createServer(function(conn) {
var carrier = carrier.carry(conn);
carrier.on('line', function(line) {
console.log('got one line: ' + line);
});
});
server.listen(port);

0 comments on commit 84b8f75

Please sign in to comment.