0.0.0 • Published 11 years ago

jsonwire v0.0.0

Weekly downloads
4
License
-
Repository
github
Last release
11 years ago

jsonwire

newline delimited json messages read/write stream

var socket;

var app = through(function(msg) {
    // handle parsed objects here
});

var wire;
socket.pipe(wire = jsonwire(app)).pipe(socket);

wire.on('error', function(err) {
    // some parsing or other error
    // pipes are disconnected now
    // up to you to reconnect
});

// app just emits whatever it wants sent
app.emit('data', {foo:'bar'});