Questions tagged [messagepack]

MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.

http://msgpack.org/

MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.

Typical small integer (like flags or error code) is saved only in 1 byte, and typical short string only needs 1 byte except the length of the string itself. [1,2,3] (3 elements array) is serialized in 4 bytes using MessagePack as follows:

> require 'msgpack'
> msg = [1,2,3].to_msgpack  #=> "\x93\x01\x02\x03"
> MessagePack.unpack(msg)   #=> [1,2,3]

Scalable RPC

MessagePack-RPC is cross-language RPC library for client, server and cluster applications. Because it releases you from complicated network programming completely and provides well-designed API, you can easily implement advanced network applications with MessagePack-RPC.

require 'msgpack/rpc'
class MyHandler
  def add(x,y) return x+y end
end
svr = MessagePack::RPC::Server.new
svr.listen('0.0.0.0', 18800, MyHandler.new)
svr.run

require 'msgpack/rpc'
c = MessagePack::RPC::Client.new('127.0.0.1',18800)
result = c.call(:add, 1, 2)  #=> 3

MessagePack is available for many languages:

  • C
  • C++
  • D
  • Erlang
  • Go
  • Haskell
  • Java
  • OCaml
  • Python
  • Perl
  • PHP
  • Ruby
  • Scala
72 questions
155
votes
6 answers

Performant Entity Serialization: BSON vs MessagePack (vs JSON)

Recently I've found MessagePack, an alternative binary serialization format to Google's Protocol Buffers and JSON which also outperforms both. Also there's the BSON serialization format that is used by MongoDB for storing data. Can somebody…
Alex
  • 8,245
  • 8
  • 46
  • 55
13
votes
2 answers

MessagePack: fast cross-platform serializer and RPC - please share experience

Looking for some fast, simple and stable RPC library I stumbled upon MessagePack project which seems to be very good. It is also under active development. If you used it in any way, could you please share your experience? P.S. I think this question…
Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
12
votes
4 answers

Using MessagePack with Android

Has someone tried to use MessagePack with an Android app? Is it possible? I have tried to use the Jar from msgpack-java and received the following Exception: Caused by: java.lang.ExceptionInInitializerError at…
arbuzz
  • 396
  • 3
  • 12
9
votes
4 answers

Confusion over JavaScript implementations of MessagePack

The official MessagePack page links to the page: https://github.com/msgpack/msgpack-javascript but its last update is three years ago. On the other hand, there are other implementations of MessagePack in JavaScript such…
sawa
  • 165,429
  • 45
  • 277
  • 381
8
votes
0 answers

MessagePack: is there a "grammar" for valid msgpack structures?

The MessagePack specification helps you to learn about the available data types and their binary representation. However, I can't find information on the "grammar" that has to be used for building valid msgpack structures (since it's not a textual…
ceran
  • 1,392
  • 1
  • 17
  • 43
8
votes
0 answers

Apache Avro vs Messagepack performance 2013

I have been reading a lot about Avro and Messagepack these days. Not sure which one to use when. One of the major questions I have is the difference in performance between the two on the following metrics: serialization speed deserialization…
AKIWEB
  • 19,008
  • 67
  • 180
  • 294
8
votes
5 answers

How to use MessagePack in C#?

I read the msgpack-cli quick start documentation. I also got the C# (CLI) NuGet package (v0.3). None of the classes (eg BoxingPacker, CompiledPacker or ObjectPacker) mentioned in the official documentation exist in the NuGet package (!!). I'm…
DeepSpace101
  • 13,110
  • 9
  • 77
  • 127
7
votes
3 answers

Sending binary data over websocket with cowboy and MessagePack

I'm trying to send a MessagePack-encoded message from Cowboy to a browser over WebSocket, and received data is always empty or invalid. I'm able to send binary data from JS to my cowboy handler, but not vice versa. I'm using Cowboy 1.0.4 with…
5
votes
1 answer

Using MSGPACK_DEFINE without changing class declarations

Is there a way in MsgPack C++ to use MSGPACK_DEFINE without altering the class members? We'd like to keep message pack stuff out of the headers, and only use it internally in a library. It seems like just wrapping each class would work, but am…
Noah Watkins
  • 5,446
  • 3
  • 34
  • 47
5
votes
2 answers

MessagePack slower than native node.js JSON

I just installed node-msgpack and tested it against native JSON. MessagePack is much slower. Anyone know why? Using the authors' own benchmark... node ~/node_modules/msgpack/bench.js msgpack pack: 4165 ms msgpack unpack: 1589 ms json pack: …
Brian Carlson
  • 61
  • 1
  • 3
5
votes
1 answer

Storing a MessagePacked hash in Redis

I'm having a problem storing a MessagePacked hash in Redis. I've pasted a test case below. When pulling out the packed data from Redis and unpacking it, the hash is slightly corrupted. This appears to happen when the hash values are beyond a…
Evan Pon
  • 1,496
  • 1
  • 13
  • 22
4
votes
0 answers

Support for encoding /decoding json request/response in ElasticSearch

Can I have a custom Protobuf/MessagePack encoding/decoding module in Elasticsearch, so that request from my client and response from server can be encoded.
anaray
  • 309
  • 1
  • 8
4
votes
4 answers

Golang: Parsing benchmarking between message pack and JSON

We are working on a TCP server which takes simple textbased commands over TCP (similar to redis) We are tossing up between using raw text command, JSON or message pack (http://msgpack.org/) An example of a command could be: text command: LOCK…
samol
  • 18,950
  • 32
  • 88
  • 127
4
votes
2 answers

Serializing with Messagepack

I like to serialize my java class object using Messagepack. My class structure is such that public class A { private InnerClass obj; //Some other variables with getters and setters. // There will be a getter and setter for obj(InnerClass)…
Muzy
  • 505
  • 2
  • 6
  • 16
3
votes
2 answers

Automated conversion between immutable business objects and MessagePack messages

In Java, I would like to use hierarchies of immutable POJOs to express my domain model. e.g. final ServiceId id = new ServiceId(ServiceType.Foo, "my-foo-service") final ServiceConfig cfg = new ServiceConfig("localhost", 8080, "abc",…
Chris B
  • 9,149
  • 4
  • 32
  • 38
1
2 3 4 5