Acceptor-Connector Multi-Transport Services
npm install coupler
var coupler = require('coupler');
var echo_protocol = {
echo: function(message, callback) {
callback(null, 'PING! ' + message);
}
};
coupler.accept(tcp: 7070).provide(echo: echo_protocol);
var coupler = require('coupler')
, echo_service = coupler.connect(tcp: 7070).consume('echo');
echo_service.on('connected', function() {
echo_service.echo('Hello World!', function(err, message) {
if (err) { return console.log(err.stack); }
console.log(message);
});
});
Copyright (c) 2012 Matt Insler
Licensed under the MIT license.