coupler

Acceptor-Connector Multi-Transport Services

coupler

Acceptor-Connector Multi-Transport Services

npm install coupler
var coupler = require('coupler');
 
var echo_protocol = {
  echofunction(messagecallback) {
    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(errmessage) {
    if (err) { return console.log(err.stack); }
    console.log(message);
  });
});

Copyright (c) 2012 Matt Insler
Licensed under the MIT license.