Coder Social home page Coder Social logo

axon-rpc's Introduction

axon-rpc's People

Contributors

bretcope avatar bryanmacfarlane avatar stagas avatar tj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

axon-rpc's Issues

bidirectional rpc

Can there be a bidirectional rpc with only one side opening one connection?

With dnode that's possible by combining two streams with mux-demux.

hooks

@visionmedia figured I would get some feedback before I add this, something you would pull in? My main use-case is using before hooks to clean up some validation mess in my methods and then leverage after hooks for logging, redis-counters, etc.

Option A:

before hooks

server.before(function(msg, next){
  // muck with msg if you want
  next();
});

server.before('add', function(msg, next){
  // muck with msg if you want
  next()
});

after hooks

server.after(function(res){
  console.log('generic logging')
});

server.after('add', function(res){
  console.log('sum = %s', res)
});

Option B:

Reconfigure a few things to maintain a connect like function stack ala middleware.

server.use(before);
server.use(server.dispatch)
server.use(after);

function before(msg, next){

};

function after(msg, next){

}

Namespace Support

I recently tried to expose a module that looked a bit like:

module.exports = {
  user: {
    get: function(id){...},
    remove: function(id){...},
  },
  users: {
    get: function(){... return all ...},
  }
};

I'm actually using a wrapper around the client call that allows me to reference methods like:

myclient.user.get(123,function(data){
  console.log('Got user',data);
});

Anyhow, this is more of a feature request. I'd like the ability to namespace my modules as shown above. The work is already done (see below).

@visionmedia - I don't know if this fits in with your vision of axon-rpc or not. It shouldn't affect current functionality, but I wasn't able to run the tests (they failed on a raw clone of the repo, i.e. before I made any changes). Anyhow, I setup a PR with my additions. It's yours for the taking. Either way, I personally have a need for this functionality via npm. I have no problem publishing it separately, but if you end up keeping it, let me know so I don't needlessly duplicate a module. npm has enough clutter already.

RPC server crash if no argument is passed from client.

When you call a remote function, with no extra arguments passed, the rpc-server crashes with the error: TypeError: undefined is not a function
client.call('add', 1, 2, function(err, n){ console.log(n); // => 3 })
Noticing how in the example two arguments are passed I don't see why not adding one at all should be a problem. Isn't the callback in the argument always arguments.length - 1?

Maybe there's something I failed to see, but couldn't really find out what it was.

Thanks in advance.

RPC Dispatcher

It would be cool to take this one step further.. an RPC dispatcher... essentially your clients connect to a dispatcher, which has several workers connected to it. The RPC request then gets forwarded to the next free worker, and the request/response routed appropriately.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.