protocol-buffers-stream
Streaming protocol buffers for Node.js
npm install protocol-buffers-stream
Usage
Assuming you have the following schema
message Test {
required string hello = 1;
}
Run the following example
var protobufs =var fs =var schema = fsvar createStream =var stream =// send a test message// if your schema message was named example this method would be called examplestream// receive a test messagestream// just pipe to ourselves for testingstream
Encoding
Each buffer is sent using the following encoding
----------------------------------------------
| frame length | message id | message buffer |
----------------------------------------------
The first message sent is a handshake message that contains the message ids of the following messages
If you know that your schema won't change you can pass {handshake:false}
to createStream
to disable handshaking
License
MIT