Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

peer-request

0.1.2 • Public • Published

peer-request

A meta-class for peer-to-peer-requests using symetric protocols.

Usage

new PeerRequest(name, inputDefinition, outputDefinition, validationFunction)

The validation function will be called with the incoming/outgoing data and it's definition.

sendRequest(send, data, cb)

  • send: The function that will handle sending the request
  • data: The data to send in the request
  • cb: The callback that will be called with an error or result

handleRequest(respond, data, handler)

  • respond: The function that will handle sending the results
  • date: The data the other peer sent
  • handler: The function that will be passed the data and a callback

install

npm i peer-request

Downloadsweekly downloads

7

version

0.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability