I felt that it'd be helpful to allow people to send any JSON type rather than just binary data. You can actually write Javascript objects, arrays, strings, and numbers to any stream or stream metadata in addition to binary. By using it as part of wire protocol it only adds exactly one byte to each message, so why not.
Is it possible to send raw bytes as WebSocket messages or are we forced to use MessagePack. I can see the benefit of sending structured data but for images or sound, what's the benefit of a intermediary serialization format vs chunked binary?
First of all, this looks great. But is there a reason to use this custom BinaryPack format, over another binary JSON-alike such as msgpack, which already has a lot of bindings in other languages?
I'm glad you asked! BinaryPack is actually a extended version of msgpack. Specifically msgpack doesn't differentiate between binary and string types. This is fine for most dynamic languages as "strings" can hold both string and binary data. However Javascript has very distinct binary types and thus we need separate types within the serialization format.