Skip to content

Simple extension message to implement a custom duplex RPC protocol

License

Notifications You must be signed in to change notification settings

mafintosh/hypercore-extension-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hypercore-extension-rpc

Simple extension message to implement a custom duplex RPC protocol

npm install hypercore-extension-rpc

Usage

const Service = require('hypercore-extension-rpc')

const service = new Service('my-service', feedOrStream, {
  // called when the other side sends a request
  onrequest (command, value, from, reply) {
    console.log('got', command, value, 'from', from.remotePublicKey)
    reply(null, Buffer.from('reply payload'))
  }
})

service.request('test', Buffer.from('request payload'), function (err, replyPayload) {
  // called when the other side replys
})

License

MIT

About

Simple extension message to implement a custom duplex RPC protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published