transparent-rpc
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Transparent RPC

Build Status Coverage Status Dependency Status Language grade: JavaScript

Automatic Proxy-based RPC for Node.js

How to use:

  • Add $rpcMethods property to the prototype of the classes you want to export

  • Create rpc.Socket object wrapping the transport layer (an object-mode stream supporting arbitrary objects)

    const rpc = require('transparent-rpc');
    let socket = new rpc.Socket(...);
    
  • Publish the first stub object:

    let id = socket.addStub(mystub);
    
  • Transmit the ID of the stub out of band

  • Handle methods on the stub

  • Objects received by the stub will be proxies

  • Invoking a method on a proxy returns a promise for the execution of that method

  • To publish more objects, return them from the stub's methods, or pass them them to remote proxy methods

Readme

Keywords

Package Sidebar

Install

npm i transparent-rpc

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

118 kB

Total Files

14

Last publish

Collaborators

  • gcampax
  • sileixu