Package Exports
- pull-pb-rpc
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pull-pb-rpc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
pull-pb-rpc
Protocol Buffers RPC utility module for pull-streams
Usage
const conn = getConnectionSomehow()
const PBRPC = require('pull-pb-rpc')
const pbRPC = PBRPC()
const rpc = pbRPC.rpc
pull(
conn,
pbRPC,
conn
)
rpc.read(Request).then(request => {
// ...
})
API
Constructor:
opts.timeout
:Number
Default timeout for readingopts.lpFixed
:Boolean
Whether to use fixed length-prefixes instead of varInt onesopts.lpMaxLength
:Number
Default maximum message length in bytes for length-prefixed reads
.read(Proto[, max, timeout, fixed])
Read a Protocol Buffers message
Proto
: Protocol Buffers Protocol as returned byprotons
max
:Number
Maximum message length in bytestimeout
:Number
Timeout for readingfixed
:Boolean
Flag whether to use fixed length-prefixes instead of varInt ones
.write(Proto, data[, fixed])
Write a Protocol Buffers message
Proto
: Protocol Buffers Protocol as returned byprotons
data
:Object
Message payloadfixed
:Boolean
Flag whether to use fixed length-prefixes instead of varInt ones
.readLP([max, timeout, fixed])
Read a length-prefixed message
max
:Number
Maximum message length in bytestimeout
:Number
Timeout for readingfixed
:Boolean
Flag whether to use fixed length-prefixes instead of varInt ones
.writeLP(data[, fixed])
Write a length-prefixed message
data
:Buffer
Message payloadfixed
:Boolean
Flag whether to use fixed length-prefixes instead of varInt ones
.readRaw(bytes[, timeout])
Read bytes
bytes
:Number
Amount of bytes to readtimeout
:Number
Timeout for reading
.writeRaw(data)
Write bytes
data
:Buffer
Message payload