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

C# / MsgPack.CLI: Order of deserialization

I am trying to deserialize a MsgPack packet that I have in a byte array like this: 47 52 209 0 144 209 0 144 72 86 54 195 209 66 73 And I want to get it into an object of this type: public class Info { public byte wX; public byte wY; …
Lucahk
  • 21
  • 4
0
votes
1 answer

zshell pip can't find package autobahn[serialization]

I was trying to install serialization variant of autobahn. However, when I do that in zsh, I get an error. zsh: no matches found: autobahn[serialization] However, as soon as I use bash, it works. Below is my command line log: kapil@kapil-linux ~ …
Kapil Sharma
  • 1,412
  • 1
  • 15
  • 19
0
votes
1 answer

Defining optional parameters using MSGPACK_DEFINE in C++14

Using C++14 I want to define optional parameters for msgpack. Right now I have something like this: MSGPACK_DEFINE(varA, varB, varC);, where each of these variables is optional and changes with the specific type I am trying to pack. For example, one…
Makoto
  • 1,520
  • 2
  • 12
  • 19
0
votes
1 answer

Emit socket.io message with Python using nodejs as server

I need a bit of help. I'm doing tests to learn how to build a realtime web, so I use node.js with socket.io. All works fun but if I try to publish some message in the channel that is listening node with a different source that isn't node or…
0
votes
2 answers

direct access to msgpack'd element N from python

I have a block of msgpack'd data is created as shown below: #!/usr/bin/env python from io import BytesIO import msgpack packer = msgpack.Packer() buf =…
mr19
  • 187
  • 1
  • 15
0
votes
1 answer

msgpage C++ : send raw pointer with MSGPACK_DEFINE

I would like to send the following struct over msgpack. struct MyStruct { std::string name{""}; int* val{nullptr}; MSGPACK_DEFINE( name, val ); }; Thus far in all of my projects, the only way I've streamed with msgpack…
kiss-o-matic
  • 1,111
  • 16
  • 32
0
votes
1 answer

Why msgpack is slower than json.parse?

I am investigating different data format (string vs masgpack byte) to encode and decode json efficiently. The jsons which I will recieve wont have any schema, atleast to keep it generic, I am assuming the jsons dont follow any specific schema. Here…
0
votes
1 answer

How to save a R dataframe in msgpack format?

I'm looking for a way to save a R dataframe in msgpack format. With pandas we do that with df.to_msgpack, I've found this https://gist.github.com/abicky/4433343 to read msgpack[1] file in R. So how to write a R dataframe in msgpack ? [1] …
user3313834
  • 7,327
  • 12
  • 56
  • 99
0
votes
1 answer

Packing/Unpacking C-Style Arrays with Msgpack

I have downloaded 1.4.1 and searched all the examples, Wiki and on Google as well but couldn't find anything, so turning here. Is there any way that I can pack/unpack arrays having data type of char, std::string, user defined class? char…
Owais
  • 21
  • 1
  • 6
0
votes
1 answer

how to view decoded messagepack data in redis-cli

i have data stored in redis in messagepack. How to view the data decoded in redis-cli. I don't see any commands related to it.
Krishna Deepak
  • 1,735
  • 2
  • 20
  • 31
0
votes
1 answer

MessagePack RPC C# - Server side

I have a problem when trying to consume a server implementation of MessagePack RPC. I wrote one implementation for client and one for server based on a Python code provided by my company's client. The server implementation should be consumed by…
0
votes
1 answer

Why am I getting negative compressions, for Gzip, Snappy, Smile?

I was trying to investigate what compression was suitable for my application for compression JSON string. The aim here is to compression entity JSON before persisting to REDIS. Here are my results Gzip Compression Trial compression percent :…
R K Punjal
  • 1,445
  • 1
  • 15
  • 20
0
votes
1 answer

how to pack multi-key map with msgpack-c

I am trying to use msgpack (in c version, not c++) to replace our own serialization method, which is in primary xml based. It is quite straight forward to pack some ordinary data. However, we have a lot of k-v based structures like struct Table { …
pepero
  • 7,095
  • 7
  • 41
  • 72
0
votes
0 answers

Add external type serialization to msgpack

How can I add an external type (a complex type in a third-party library for example) to msgpack serialization? I have a class foo which has a member of type bar implemented in libbar.so and I want to serialize foo such that it includes its bar. In…
sorush-r
  • 10,490
  • 17
  • 89
  • 173
0
votes
1 answer

Nested Collections with MsgPack

I have following generic dictionary inside class I want to pack/unpack with MsgPack: public Dictionary values { get; set; } Packing and unpacking works staight out of the box in common cases, but if a new dictionary new…
Fdr
  • 3,726
  • 5
  • 27
  • 41