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
1 answer

MSGPACK-RPC (C++) under windows

Did anyone managed to put msgpack-rpc (C++) to work under windows, through cygwin or mingw? Thanks, SwatchPuppy
SwatchPuppy
  • 324
  • 1
  • 3
  • 15
0
votes
0 answers

Best option for object-per-line storage in python

Currently I'm storing a bunch of records (nested dictionaries of stuff) as JSON record-per-line in a file (for a machine learning task). Reading them is a bottleneck, so I'm looking for a faster storage format. So far I looked at pickle and msgpack,…
Maxim Khesin
  • 597
  • 4
  • 10
0
votes
1 answer

VerificationException "Operation could destabilize runtime" Error with MsgPack and .net Error

Encountered VerificationException "Operation could destabilize runtime" error using MsgPack to serialize some F# types. The compiler also suggests that conflicting class libraries may be loaded, but this appears to be a red herring. It's not…
Anthony
  • 1,306
  • 4
  • 13
  • 23
0
votes
1 answer

msgpack: pack the class in member-function

I'm pretty new to "msgpack". I'm trying to pack the user-defined class: MyClass::Pack() { msgpack::sbuffer sbuf; msgpack::pack(sbuf, this); } But compiler (VC 9.0) says me error C2228: left of '.msgpack_pack' must have class/struct/union…
maverik
  • 5,508
  • 3
  • 35
  • 55
0
votes
1 answer

Does an unpacked msgpack_object depend on the buffer from which it is unpacked?

Based on the bizarre behaviour I'm seeing, I'm guessing that the following code is not valid. My question is: does the msgpack_object created below depend on the msgpack_sbuffer? That is, is the msgpack_object (in msg.data) invalid, once…
brooks94
  • 3,836
  • 4
  • 30
  • 57
0
votes
1 answer

Why are MsgPack keys of type msgpack_object?

In the C API for MsgPack, why are keys (for example the key field of msgpack_object_kv) of type msgpack_object? https://github.com/msgpack/msgpack-c/blob/master/src/msgpack/object.h Why aren't they just msgpack_object_raw? Can they be any type?
brooks94
  • 3,836
  • 4
  • 30
  • 57
0
votes
1 answer

BSON to Messagepack

The problem that I am facing is that BSON comes with ObjectId and Timestamp which are not supported in Messagepack and it aint possible to define a custom serializer for Messagepack (at least as far as I know). I wrote a piece of python code to…
Jermin Bazazian
  • 1,932
  • 2
  • 17
  • 20
0
votes
1 answer

Serializing object using messagepack and as3

This is a vary simple question, but can't find any docs on it. I have a simple class: public class User { public var name:String; public var age:int; } I would like to serialize it using this: var user:User = new User(); user.age =…
Mike Z
  • 1,467
  • 2
  • 14
  • 16
0
votes
3 answers

MessagePack template lookup causing stuck threads in WebLogic?

We're using MessagePack 0.6.6 for Java in Grails 2.0 on WebLogic 11g (10.3) to serialize string data... public void serialize(Object object, OutputStream outputStream) throws IOException { byte[] bytes = MessagePack.pack(object); …
raffian
  • 31,267
  • 26
  • 103
  • 174
0
votes
1 answer

create debug version of python package python-msgpack for Ubuntu

I need a version of messagepack that i can use with python2.7-dbg. How would I go about creating one? for reference I've asked via an issue on github https://github.com/msgpack/msgpack-python and here's a little context python-dbg can't find…
Hunter Barrington
  • 143
  • 1
  • 1
  • 11
0
votes
2 answers

Building msgpack-python on Solaris 10 - Use of is valid only in a c99 compilation environment

I'm trying to build the python module msgpack-python on Solaris with the Sun compiler and am getting this error during the python ./setup.py build: /opt/SUNWspro/bin/cc -DNDEBUG -O -xO3 -m32 -xarch=sparc -I/opt/csw/include -xcode=pic32…
user1522264
  • 123
  • 1
  • 1
  • 5
-1
votes
2 answers

How to display a message packed structure

I am trying to convert a struct into msgpack in C or C++. Please find the code below: struct your_type { int a; float b; MSGPACK_DEFINE(a, b); }; int main() { // packing std::stringstream ss; …
-1
votes
1 answer

MsgPuck : How to compose an array of maps in msgpuck?

I am trying to construct a MsgPack object, using MsgPuck library for the following JSON object: { "Key_1": "val_1", "array_1": [ { "key_3": "val_3", "key_4": "val_4" } ] } The…
user58626
  • 1
  • 1
-1
votes
1 answer

MessagePack Perl to C++ deserialisation

I'm new to messagepack, and I'm trying to take a hash in perl, serialize it using messagepack, write it to a file, pass that to c++ code where the file is read and deserialized into a map. My perl code to generate the file is (note - I added an…
rbennett485
  • 1,907
  • 15
  • 24
-1
votes
1 answer

recv return after 0x0000 byte found

Here is my code: Client Position pos(1.0,2.0,0.45); feedback feed(12, pos, 100); msgpack::sbuffer sbuf; msgpack::pack(sbuf, feed); int test = write(tcp_client.sockfd, sbuf.data(),sizeof(sbuf)); Server : char* buffer = new char[41]; int…
Vtik
  • 3,073
  • 2
  • 23
  • 38
1 2 3
27
28