multi-channel-shoe

Create multiple channels using shoe

npm install multi-channel-shoe
12 downloads in the last month

multi-channel-shoe

Create multiple channels using shoe

Example server

var multiChannel = require("..")
    , net = require("net")
    , MuxDemux = require("mux-demux")
    , streamStore = require("memory-store")

net.createServer(function (con) {
    var mdm = MuxDemux({
        error: false
    })
    mdm.on("connection", multiChannel(streamStore))
    con.pipe(mdm).pipe(con)
}).listen(8642)

Example client

var net = require("net")
    , MuxDemux = require("mux-demux")
    , mdm = MuxDemux()
    , con = net.connect(8642)

mdm.pipe(con).pipe(mdm)

var room1 = mdm.createStream("multi-channel-room1")
    , room2 = mdm.createStream("multi-channel-room2")

room1.on("data", console.log.bind(console, "room1"))
room2.on("data", console.log.bind(console, "room2"))

room1.write("hello")
room2.write("world")

Installation

npm install multi-channel-shoe

Contributors

  • Raynos

MIT Licenced

npm loves you