folk-protocol
Wire format for Folk: typed RPC messages and length-prefixed framing.
What this crate provides
- [
RpcMessage]: the three message variants ofMessagePack-RPC (Request,Response,Notify), encoded as positionalMessagePackarrays. - [
FrameCodec]: a Tokio codec that combines a 4-byte big-endian length prefix withrmp_serdepayload encoding/decoding. - [
Error]: a single error type for all fallible operations in this crate.
Wire format
Every message on the wire is:
+----------------+---------------------------------+
| 4-byte length | MessagePack-encoded array |
| big-endian | (the RpcMessage payload) |
+----------------+---------------------------------+
Maximum frame size is [MAX_FRAME_SIZE] (16 MiB). See
folk-spec/spec/02-protocol.md for the full specification.
Example
use BytesMut;
use ;
use Value;
use ;
let mut codec = new;
let msg = request;
let mut buf = new;
codec.encode.unwrap;
let decoded = codec.decode.unwrap.unwrap;
assert_eq!;