# `Zizq.Codec.MessagePack`
[🔗](https://github.com/zizq-labs/zizq-elixir/blob/v0.8.0/lib/zizq/codec/message_pack.ex#L4)

MessagePack codec, built on `Msgpax`. The default.

## Binaries are strings, not bytes

Elixir does not distinguish a UTF-8 string from a byte array (both
are `t:binary/0`) so `Msgpax` packs every binary as a MessagePack
*str*, never a *bin*. That matches the server, which types payloads
as JSON values and rejects `bin` outright, so `Msgpax.Bin` should be
avoided.

The consequence is that a binary which is not valid UTF-8 encodes
without complaint locally but is refused by the server:

    HTTP 400  invalid MessagePack: string found to be invalid utf8

Encode raw bytes as base64 in a string, exactly as JSON would
require.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
