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
2
votes
2 answers

can't decode encrypted string in python from messagepack (Ruby openssl)

I'm having trouble unencoding some data I get from a socket connection through messagepack, and consequentially unencrypting it. I get the string in from a Ruby on Rails web application in UTF-8 and use messagepack to bundle it all up and send it…
Hunter Barrington
  • 143
  • 1
  • 1
  • 11
1
vote
1 answer

Receiving a stream with msgpack in C

I'm implementing a server that receives a stream of bytes from the client. The stream is serialized using msgpack, (and the first thing that is serialized is the length of the remaining stream). My question is, What's the correct way of receiving…
Drxxd
  • 1,860
  • 14
  • 34
1
vote
2 answers

What's the Transport Protocol for MessagePack / Protocol Buffers?

There are couple of libs for data serialisation like MessagePack, Protocol Buffers etc. But what should be the Transport Protocol? Should it be HTTP REST or any other? To me it doesn't make much sense to use REST because HTTP has overhead. So, if…
Alexey Petrushin
  • 1,311
  • 3
  • 10
  • 24
1
vote
1 answer

MessagePack: disable integer compression

I am using the MessagePack for CLI (https://github.com/msgpack/msgpack-cli) library and I am wondering, if it's possible to disable the integer compression. For example: // The following collection object[] { (Int32)10, (Int32)100, (Int32)1000 }; //…
Filip Minx
  • 2,438
  • 1
  • 17
  • 32
1
vote
1 answer

MessagePack Java serializing as array

Is it accepted behaviour that MessagePack official implementation in Java serializes public fields as Arrays? In what universe is this "like JSON"? My case: I have a simple class like so: @Message public class MySuperClass(){ public int…
Jo Colina
  • 1,870
  • 7
  • 28
  • 46
1
vote
1 answer

Why does the list force all new items to duplicate themselves?

I have cut down the code from my project significantly so it's copy and pastable but if you want to debug in a console project it'll need the nuget package: Install-Package MsgPack.Cli. Ok, below I have commented on the line that is the issue, all I…
Fred Johnson
  • 2,539
  • 3
  • 26
  • 52
1
vote
0 answers

Messagepack, CSharp and Abstract Classes

I have the following Code: _serializerResponse = MessagePackSerializer .Get(); and I try to get the MessagePackSerializer! But it gives me the following error: This operation is not supported because 'AbstractWebResponse'…
Jochen Kühner
  • 1,385
  • 2
  • 18
  • 43
1
vote
1 answer

message pack - how to find the represented string?

in the message pack website : Message Pack there is "Try" link above where it shows me how long is the representing string for the data. I have a small script that is based on the examples presented in the message pack git hub #include…
yanish
  • 257
  • 2
  • 15
1
vote
1 answer

System.TypeLoadException: Access is denied when using MessagePack

I'm trying to use MessagePack to serialize my objects, but whenever I try to run the serialization I'm getting an Unhandled Exception error. Here's my code: CSCDP_TCPClient.cs using System.Text; using System.Threading.Tasks; using…
user2753743
  • 41
  • 1
  • 4
1
vote
1 answer

Netty NioSocketChannel got broken message on multithread write

I'm writing my own simple game server using Netty 4.0.25. I want to support msgpack binary data so every message send/receive on a channel always encoded/decoded by msgpack. my server: bossGroup = new NioEventLoopGroup(4); workerGroup = new…
bachden
  • 441
  • 3
  • 9
1
vote
1 answer

Unpacking a Python-generated MessagePack in C# results in "Unpacker is not in the array header"

I am trying to send a message from Python code to C# via ZeroMQ. I am using the following data structure in Python: message = msgpack.packb( ( {"message_id": "1001", "type": "GET", "namespace": "DocumentManager"}, …
Alex Bausk
  • 690
  • 5
  • 29
1
vote
1 answer

Possible encoding issues when serializing user defined type using MessagePack in Delphi?

I'm trying to serialize a Record in Delphi by using MessagePack and then using ZeroMQ TCP protocol I send it to a Python server. b'\xa8DataType\x01\xa4data\xbf{"major":1,"minor":0,"build":2}\x00' I'm having trouble deserializing it on the server…
Yako
  • 191
  • 1
  • 2
  • 12
1
vote
1 answer

Linker error when installing MessagePack implementation for C and C++

I'm following the instructions, which tell me to download msgpack 0.5.4 for C & C++. On Windows, download source package from here and extract it. Open msgpack_vc8.vcproj or msgpack_vc2008 file and build it using batch build. It builds libraries in…
Breina
  • 538
  • 5
  • 20
1
vote
0 answers

how to deserialized the Messagepack data On REST server client

I am trying to use message pack library t serialize my data in REST server client environment I and serialize the data using the code below : std::vector target; target.push_back("Hello,"); target.push_back("World!"); //…
Yogesh patel
  • 1,351
  • 2
  • 15
  • 21
1
vote
0 answers

Implementing MessagePack using Javascript

I recently read about using the MessagePack in WEBAPI to improve the performance. Though I am not able to consume the same in client side using javascript. I read in one of the forum to use the https://github.com/msgpack/msgpack-node But I am…