Skip to content

Instantly share code, notes, and snippets.

@geNAZt
Created January 24, 2013 16:41
Show Gist options
  • Save geNAZt/4624777 to your computer and use it in GitHub Desktop.
Save geNAZt/4624777 to your computer and use it in GitHub Desktop.
var MuxDemux = require('mux-demux');
var net = require('net');
var mdm = MuxDemux(function (stream) {
console.log("Connection: ", stream);
stream.on('data', function (data) {
console.log(data);
});
})
net.createServer(function (con) {
con.clientid = mdm.createID();
console.log(con);
con.pipe(mdm).pipe(con);
}).listen(8642);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment