Created
January 19, 2012 09:15
-
-
Save timoxley/1638911 to your computer and use it in GitHub Desktop.
Bidirectional upnode
This file contains hidden or 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 upnode = require('upnode') | |
var dnode = require('dnode') | |
var assert = require('assert') | |
var PORT = 5000 | |
var client = upnode(function(remote, connection) { | |
connection.on('remote', function(remote) { | |
remote.testServer(function(err, value) { | |
assert.ok(!err) | |
assert.equal(value, 'server success') | |
console.log(value) | |
}) | |
}) | |
this.testClient = function(callback) { | |
callback(null, 'client success') | |
} | |
}).connect(PORT) |
This file contains hidden or 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 upnode = require('upnode') | |
var dnode = require('dnode') | |
var assert = require('assert') | |
var PORT = 5000 | |
var server = dnode(function(remote, connection) { | |
connection.on('remote', function(remote) { | |
remote.testClient(function(err, value) { | |
assert.ok(!err) | |
assert.equal(value, 'client success') | |
console.log(value) | |
}) | |
}) | |
this.testServer = function(callback) { | |
callback(null, 'server success') | |
} | |
console.log(arguments) | |
}).use(upnode.ping).listen(PORT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment