Skip to content

volks73/framed-msgpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

framed-msgpack

What is framed-msgpack?

The framed-msgpack project is a Rust crate, a.k.a. library, that provides a codec for use with the tokio-rs project. MessagePack-based messages, or payloads, are sent and received with the total message length prefixed as a 32-bit unsigned integer encoded in four (4) Big-Endian bytes. The implementation is largely based on the length delimited codec provided in the tokio-io module but instead of decoding and encoding a payload from a stream and sink into a byte buffer, a payload is decoded and encoded as MessagePack messages without the prefix length bytes, respectively.

Usage

First, add this to your Cargo.toml:

[dependencies]
framed-msgpack = { git = "https://github.com/volks73/framed-msgpack.git" }

Next, add this to your crate:

extern crate framed_msgpack;

Getting Started

Clone this repository, then run the following command:

$ cargo run --example echo_server

This will run a server at localhost:12345. From another terminal, connect to the server and send framed-msgpack messages. The binary messages will be returned unchanged. A combination of the netcat, nc, application on UNIX-like systems, or ncat for Windows, and the panser application can be used to create framed-msgpack messages to send to the example echo server. For example,

$ echo '[0,1,2]' | panser --from json --to json --sized-output | nc localhost 12345 | panser --from msgpack --to json --sized-input --delimited-output 0Ah
[0,1,2]
$

License

See the LICENSE file for more information about licensing and copyright.

About

A MessagePack-based codec with a prefixed length for use with tokio-rs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages