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

2.0.1 • Public • Published

Another RPC Implementation

API Documentation

rpc-prototype

Example

const rpt = require("rpc-prototype")

let alice = new rpt.RPC();
let bob = new rpt.RPC();

alice.pipe(bob).pipe(alice);

alice.then(result => {
  console.log('Alice:', result);
});

bob.then(result => {
  console.log('Bob:', result);
});

alice.on('ping', (resolve, reject, data) => {
  console.log('Alice:', data);
  resolve(data); // Sends response with 'Hello World!'
});

bob.exec('ping', 'Hello World!').then(result => {
  console.log('Bob:', result); // Prints 'Hello World!' 
}).catch(error => {
  throw error;
});

bob.end('End of bob');

Test above code in your browser

for more examples

Package Sidebar

Install

npm i rpc-prototype

Weekly Downloads

0

Version

2.0.1

License

MIT

Last publish

Collaborators

  • vmolsa