I am working with remote procedure calls and I am using a library called node-jet for that. I can add methods and can get run them remotely, but I want to ask if I can add methods remotely also ? I asked this question to library developers but can not get an answer, maybe someone here help me for that.
fn is my functions and peer is my peer
var method = new jet.Method(`${this.basePath}` + '/methods/' + method)
.on('call', fn) //function (args) {})
peer.add(method)
as I've understood it,
you're looking for bi-directional RPC, and are currently trying to achieve it using node-jet, which may or may not provide it. Which means you may have to hand roll your own solution on top of node-jet as a transport.
Instead, you could try Octopus, as your RPC layer... either standalone, or on top of node-jet.
I built it to solve a similar use case, over socket.io & node child processes. Hopefully it'll help you too !
To use with node-jet, you'll need to build a small custom adapter to integrate node-jet's push protocal. See the stockTransports.js file in the repo for examples on how socket.io, websockets etc are mapped.
just need two mappings :
return {
onRecv: // recieve function wrapper
send: // send function wrapper
}