Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: rpc-prototype
node v6.17.1
endpoint
share
tweet
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');
Created from: https://runkit.com/npm/rpc-prototype
Loading…
no comments
sign in
to comment