Questions tagged [msgpack]

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.

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
409 questions
0
votes
0 answers

When to use ext format of msgpack?

I just began to study msgpack this summer. The reason to study msgpack is plan to use that for internal message protocol for a scientific data sampling software. Well, when I read the spec of msgpack, and it's confused for me about the ext format.…
Poor
  • 51
  • 5
0
votes
1 answer

what does msgpack's object_with_zone do?

When writing a custom serializer for msgpack_c one also needs to implement object_with_zone. The documentation how to implement this is very sparse ( https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_adaptor ). In what circumstances is this method…
JE42
  • 4,881
  • 6
  • 41
  • 51
0
votes
1 answer

Can't find node-gyp

Windows 7 node 6.9 npm 3.10.8 python 2.7 node-gyp 3.6.2 VS Build tools 2015 When installing msgpack, I'm getting this error: I've already set npm_config_node_gyp as env var with…
João Paulo
  • 6,300
  • 4
  • 51
  • 80
0
votes
0 answers

Implementation of IDictionary being interpreted as Array by MsgPack-cli when unpacking

I'm trying to parse a MessagePack message. When I declare the field in question as a Dictionary everything works fine and the message is unpacked as expected. However, when I instead declare the field in question as a custom…
CSCoder
  • 154
  • 1
  • 15
0
votes
0 answers

How do I configure a Flask app inside a Docker container to parse a large MessagePack object?

I'm getting the following when sending a very large POST to a Flask application. Logs: restful stderr | /usr/local/lib/python2.7/dist-packages/werkzeug/filesystem.py:63: BrokenFilesystemWarning: Detected a misconfigured UNIX filesystem: Will use…
Jack Murphy
  • 2,952
  • 1
  • 30
  • 49
0
votes
2 answers

msgpack-python failing to deserialize -> getting ExtraData error

I'm trying to make MQTTtoROS Bridge work, and i keep getting this error: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 754,…
Animu
  • 81
  • 1
  • 15
0
votes
1 answer

Fixing 'obsolete' warning when using MsgPack.Cli

I'm using MsgPack.Cli to write a custom serializer for a Session class I have created. After creating the class using this tutorial on the MsgPack.Cli github page, I receive this warning: Warning: 'MessagePackSerializer.MessagePackSerializer()' is…
Sam
  • 3,070
  • 3
  • 20
  • 26
0
votes
1 answer

Can I use python float with precision of (float32)?

Can I use python float with precision of (float32) ? Because it will be serialized from primitive python.float(32) and will be deserialized to primitive java.float. Any libraries are not considered. ex) numpy.float32
0
votes
1 answer

autobahncpp unpack complicated msgpack message

com/crossbario/autobahn-cpp for subscribe to events from server. Server is not my own, i just need to collect information from it, but i have problem with format. I have this event and can't figure out correct type for such complicated case: RX…
xanm
  • 41
  • 3
0
votes
1 answer

ZeroMQ with msgpack, in C++, throws an invalid argument error

I am using zeromq to read data from an application which uses msgpack for serializing. The code compiles well but throws an invalid argument error when run. Where am I being wrong. Here is the error: terminate called after throwing an instance of…
0
votes
1 answer

Serialize raw Image buffer (rgb pixels) in C and deserialize in Python

I want to serialize raw image data i.e. uint16 array, and send it over to python using zmq. I am considered using msgPack-c but the only way I found was something like given How do I unpack and extract data properly using msgpack-c?. if I follow…
Mudassar
  • 1
  • 1
0
votes
1 answer

Outputting data in msgpack format with python as a cgi

I have a python utility providing results in JSON through a webserver. The way it is done is by printing "Content-type: text/html\n" and then printing the JSON.dumps result. This work fine and I am able to have a python client opening the URL and…
0
votes
1 answer

Msgpack between PHP and Javascript

I'm using official MsgPack version (http://msgpack.org/), installed for PHP 7 on server side and included as a library (msgpack.js) on client (any browser). Lets pack simple ArrayBuffer with msgpack in the browser: function s2b ( s ) { var b = new…
anpako
  • 1
  • 2
0
votes
1 answer

C# MsgPack throws when unpack list of nullable integers containing a NULL as item

I want to use MsgPack instead of Newtonsoft.JSON as it is much faster but I have an issue when trying to deserialize a list of nullable integer. Here is a snippet of the code I am using: public class MyClass { …
Bogdan MITREA
  • 101
  • 1
  • 10
0
votes
0 answers

How do I write a serializer in C using MessagePack (Mpack)

I would like to write a serializer application that will encode any type of C data structure into MessagePack format. All examples I have seen show the encoding of known structures such as this using MPack: // encode to memory buffer char*…
Koi
  • 105
  • 9