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

How do I msgpack the below parameters to send in a CURL?

device_id={UNIQUE_ID}&key={CUSTOMER_KEY} I have tried following as many examples as I could find online, but there really wasn't a lot that was helpful for me. I'm using Python and have imported the msgpack and did…
Lynn
  • 559
  • 1
  • 6
  • 22
0
votes
1 answer

Msgpack Generic serialization/desrialization

I am using msgpack integrated with Axon framework. So on the axon event handler i get object's on runtime which can be of any type.As the object type is unknown, i want to use generic serialization/deserialiation. The serialization is done properly…
Anand Kadhi
  • 1,790
  • 4
  • 27
  • 40
0
votes
1 answer

Include msgpack in cocos2d-x 3

I want to use msgpack with cocos2d-x 3. I add include_directories(msgpack/include) in cocos2d/cocos/CMakeLists.txt. but not found msgpack.hpp. How I can include and compile msgpack with cocos2d?
vahid
  • 3
  • 1
  • 3
0
votes
1 answer

Msgpack packing bools bug

For my C++ project I use c++ msgpack library available in Ubuntu (14.04) standard repository under name libmsgpack-dev. All works fine except when I try to pack some bools. There things go absolutely bananas. First I wrote simple test to study pack…
Jendas
  • 3,359
  • 3
  • 27
  • 55
0
votes
2 answers

module not loading msgpack erlang

Attempting to test msgpack as dependency in a simple release package using rebar in Erlang / OTP. My folder structure is as follows Project -> Apps -> myapp -> ebin -> src -> deps -> msgpack (folder) …
0
votes
1 answer

How to properly link msgpack into a shared library

I'm trying to compile a few .c files that used msgpack-c functions into a shared library. I have the following Makefile: MSGPACK_CS = msgpack.c CFLAGS = -std=c99 MSGPACK_OBJECTS = $(subst .c,.o,$(MSGPACK_CS)) MSGPACK_LIBS = msgpack.so all:…
petermlm
  • 930
  • 4
  • 12
  • 27
0
votes
2 answers

How does msgpack differ in perl from node.js

Does anyone have a clue why perl's MessagePack gives different results from that in Node.js . I am trying to unpack a msgpack string that was created using Perl's Message Pack and it doesn't work Example: Array ["a","b","c","d","f"] packing it in…
0
votes
1 answer

Send binary POST data with c# containing a null character

I'm trying to send msgpack data to a server with C#, this data contains a null character in the middle. because of that, the data received by the server is cut off at this character, and anything after it is lost, which of course render the msgpack…
Shurikn
  • 182
  • 1
  • 13
0
votes
1 answer

Msgpack between PHP and C++

I want to pack my class from C++ Client to PHP Server and back. but when I try to pack a PHP class and unpack it to C++ Class I got a error. this is my code in PHP class maplemessage { var $nCode; var $nType; …
Elyse
  • 111
  • 10
0
votes
2 answers

Does MessagePack allow padded integers?

I'm trying to use MessagePack to serialize integers in Erlang and Java. In Java I'm able to pad an array holding one integer with as many 0s as I wish and MessagePack.read() still returns the correct value. But in Erlang msgpack:unpack/1 fails if…
Selali Adobor
  • 2,060
  • 18
  • 30
0
votes
0 answers

ServiceStack.MsgPack+DateTimeOffset 'Stream Unexpectedly Ends'

I've been trying to convert our service stack app host and client to use MsgPack serialization. I kept getting the exception MsgPack.InvalidMessagePackStreamException Stream Unexpectedly Ends After some investigation I've tracked it down to…
antinutrino
  • 169
  • 11
0
votes
1 answer

Msgpack on Cloudant

I am trying to use msgpack with Cloudant, and I couldn't find any documentation on it. 2 years ago, Tim Anglade present msgpack as a wonderfull way to pack your data instead of JSON. I was thinking that now it was stable to post some msgpack data…
DoubleCompil
  • 125
  • 10
0
votes
1 answer

Message Pack : Do not convert System.Boolean (binary:0x0) MessagePackObject to System.Int64

We get following error while unpacking packed message to an object. This error is not noticed on local development environment (windows 7) but occurs in the server environment. (server 2008). System.Reflection.TargetInvocationException: Exception…
0
votes
1 answer

msgpack._packer does not exist in anaconda installation

I've recently changed my python installation from python xy to anaconda 64 bit on windows 7. I tried to start an application that I built that uses msgpack-python and msgpack-numpy, but all of a sudden msgpack-numpy throws an error when it is…
jkokorian
  • 2,905
  • 7
  • 32
  • 47
0
votes
1 answer

php msgpack_pack and how to convert in Unity3d C#

I wonder why using msgpack do not encrypt in php. I think "{"id":1,"v1":"bla","v2":"foo"}" will convert to hex string "83 a2 69 64 01 a2 76 31 a3 62 6c 61 a2 76 32 a3 66 6f 6f" But the result is "魷"id":1,"v1":"bla","v2":"foo"}" why? This is my…
敬錞 潘
  • 852
  • 1
  • 14
  • 29