UNPKG

grenache-nodejs-http

Version:
24 lines (18 loc) 441 B
'use strict' const Grenache = require('./../') const Link = require('grenache-nodejs-link') const Peer = Grenache.PeerRPCClient const link = new Link({ grape: 'http://127.0.0.1:30001' }) link.start() const peer = new Peer(link, {}) peer.init() const reqs = 10 setTimeout(() => { for (let i = 0; i < reqs; i++) { peer.map('rpc_test', 'hello', { timeout: 10000 }, (err, data) => { console.log(err, data) }) } }, 2000)