seaport-proxy

Seaport in the browser!

npm install seaport-proxy
6 downloads in the last week
13 downloads in the last month

seaport-proxy

Seaport in the browser!

Client Example

var boot = require("boot")
    , mdm = boot("/boot")
    , seaport = require("seaport-proxy")
    , ports = seaport(mdm)

var stream = ports.get("magic@1.2.x")
stream.on("data", console.log.bind(console, "[BROWSER]"))

stream.write("hello from browser!")

Server example

var boot = require("boot")
    , Router = require("routes").Router
    , seaport = require("seaport-proxy")

var ports = seaport.connect("localhost", 9093)

var sock = boot(ports)
sock.install(someHttpServer, '/boot')
console.log("sock hooked on", "/boot")

Magic service

var seaport = require("seaport")
    , net = require("net")

var ports = seaport.connect("localhost", 9093)

ports.service("magic@1.2.3", createMagic)

function createMagic(port, done) {
    var server = net.createServer(function (stream) {
        stream.write("hello from magic!")
        stream.on("data", function (data) {
            console.log("[MAGIC]", data.toString())
        })
    })
    server.listen(port, done)
    console.log("magic service hooked on port", port)
}

Installation

npm install seaport-proxy

Contributors

  • Raynos

MIT Licenced

npm loves you