Given a regular duplex stream, this module will return a duplex stream optimised for sending and receiving msgpack5 messages.
var net = require('net')
var msgpack = require('msgpack5-stream')
var server = net.createServer(function (socket) {
var dup = msgpack(socket)
dup.on('data', function (obj) {
console.log(obj) // { hello: 'world' }
})
})
server.listen(3000, function () {
var dup = msgpack(net.connect(3000))
dup.write({hello: 'world'})
})
MIT