Created
July 31, 2012 04:20
-
-
Save Raynos/3213571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var seaport = require("seaport-proxy") | |
, ports = seaport.connect("/winning") | |
, dnode = require("dnode") | |
ports.get('magic@1.2.x', function (stream) { | |
var d = dnode() | |
d.on("remote", function (remote) { | |
remote.magic(function (magic) { | |
console.log("beep boop", magic) | |
}) | |
}) | |
d.pipe(stream).pipe(d) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var seaport = require("seaport") | |
, ports = seaport.connect(9090, { secret: 'beep boop' }) | |
, net = require("net") | |
, dnode = require("dnode") | |
var server = net.createServer(function (stream) { | |
var d = dnode({ | |
magic: function (cb) { | |
cb("magic!") | |
} | |
}) | |
d.pipe(stream).pipe(d) | |
}) | |
ports.service('magic@1.2.3', function (port, ready) { | |
server.listen(port, ready) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var seaport = require("seaport") | |
, http = require("http") | |
, server = http.createServer() | |
, ports = seaport.connect(9090, { secret: 'beep boop' }) | |
var seaportProxy = require("seaport-proxy") | |
seaportProxy(ports, server, "/winning") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment