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

Dependents (1)

Package Sidebar

Install

npm i peer-request

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • mkg20001