msgproto

0.2.2 • Public • Published

ipfs-msgproto

This is a node module to make writing wire protocol stacks on top of streams easier. In particular, it's very helpful when your protocol layers manipulate those above (e.g. en/decryption). The way it works is that the user defines

  • a Message type that inherits from message-protocol's Message
  • a Protocol (duplex stream) for writing and reading message objects
  • a codec: json, protobuf message, or capnp struct (optional)
  • any special actions particular to the protocol (optional)

And this modules takes care of en/decoding, en/decapsulating, etc. BTW, it's recommended to use protobufs or capnp codecs for encoding/decoding to the wire. Though, at the very least, msgproto payloads are protobuf encoded, so you'll get smart wire scanning.

Install

npm install msgproto

Examples

Check out these shim protocols:

And then see this sample protocol:

Readme

Keywords

Package Sidebar

Install

npm i msgproto

Weekly Downloads

3

Version

0.2.2

License

MIT

Last publish

Collaborators

  • jbenet