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
8
votes
4 answers

msgpack C++ implementation: How to pack binary data?

I am making use of C++ msgpack implementation. I have hit a roadblock as to how to pack binary data. In terms of binary data I have a buffer of the following type: unsigned char* data; The data variable points to an array which is actually an…
mdb841
  • 131
  • 1
  • 1
  • 4
7
votes
3 answers

msgpack unserialising dict key strings to bytes

I am having issues with msgpack in python. It seems that when serialising a dict, if the keys are strings str, they are not unserialised properly and causing KeyError exceptions to be raised. Example: >>> import msgpack >>> d = dict() >>> value =…
Nathan McCoy
  • 3,092
  • 1
  • 24
  • 46
7
votes
2 answers

What is a MsgPack 'zone'

I have seen references to 'zone' in the MsgPack C headers, but can find no documentation on what it is or what it's for. What is it? Furthermore, where's the function-by-function documentation for the C API?
brooks94
  • 3,836
  • 4
  • 30
  • 57
6
votes
0 answers

Is there some DevTool to view MsgPack requests / responses?

I've been searching and I can't seem to find anything. Not sure if anyone knows of an easy way to see MsgPack requests and responses in the network tab?
Shamoon
  • 41,293
  • 91
  • 306
  • 570
6
votes
1 answer

python 3 will not find key in dict from msgpack

why does this happen in python3? 1) I get msgpack data from redis 2) I unpack I get the below 3) The returned type is a dict: meta = msgpack.unpackb(data[1]) print(type(meta)) meta = {b'api_key': b'apikey1', b'sensor_id':…
Tampa
  • 75,446
  • 119
  • 278
  • 425
6
votes
1 answer

Handle invalid msgpack messages sent from IE10

We have an application that communicate with backend via WS. We encode all messages with msgpack-lite, library specification said that it supports IE10. In all modern browsers like Chrome, Firefox, Safari and Edge all works well. But in IE10 we…
6
votes
2 answers

Android using MSGPack Core and Jackson Mapper - decode class variable of unknown type

I am sending/receiving a custom class from a server to Android, the class is as; import org.msgpack.value.Value; public class myClass { public String status; public Value data; } The problem is that I always get the…
Recycled Steel
  • 2,272
  • 3
  • 30
  • 35
6
votes
1 answer

There is an example of Spyne client?

I'm trying to use spyne (http://spyne.io) in my server with ZeroMQ and MsgPack. I've followed the examples to program the server side, but i can't find any example that helps me to know how to program the client side. I've found the class…
castarco
  • 1,368
  • 2
  • 17
  • 33
6
votes
1 answer

Serializing object with interface as property type in MessagePack

I am trying to use MessagePack to serialize an object that has a property of an interface type. When I call Pack, it throws SerializationException that says a serializer is not defined for the interface. Code example: namespace…
Yosi
  • 2,936
  • 7
  • 39
  • 64
5
votes
0 answers

Could not load file or assembly of project (when it is not referenced)

There are 3 projects: Server - game server Client - game client Shared - code shared between the Client and Server Server communicates with Client by sending MessagePack-serialized class instances from Shared. When trying to deserialize one class…
dclipca
  • 1,739
  • 1
  • 16
  • 51
5
votes
1 answer

C++ MsgPack: linker errors

I'm trying to compile the message pack (http://msgpack.org/) example code and keep getting these errors which I can't get to the bottom of: g++ -o"MsgPack2" ./src/MsgPack2.o -lmsgpack -lmsgpackc ./src/MsgPack2.o: In function…
Eamorr
  • 9,872
  • 34
  • 125
  • 209
5
votes
1 answer

User defined Class Serialization, C++ and msgpack

I am quite new trying msgpack. I need to serialize an object (instance of an user defined class), that contains pointers (internal tree, hashes,etc), and some basic types attributes. Until now I can do what is done in the quick example of…
Luchux
  • 63
  • 1
  • 4
5
votes
1 answer

Since upgrading to Angular 9 Signalr doesn't work

I have an angular application that uses signalR. It is hosted in a .NET core 3.1 application. Since upgrading to Angular 9, signalR no longer works. Everything was working fine in Angular 8. Since update, I've been getting errors like 404 Error:…
LanceM
  • 1,888
  • 4
  • 23
  • 41
5
votes
1 answer

How to save & append to a serialized MessagePack binary file in C#?

I'm trying to use MessagePack to save multiple lists of structs because I read that its performance is better than BinaryFormatter serialization. What I want to do is to receive real-time time series data and to regularly save(append) it to disk…
maynull
  • 1,936
  • 4
  • 26
  • 46
5
votes
2 answers

How to store 32-bit floats using ruby-msgpack gem?

I am working on a data system that needs to store large amounts of simple, extensible data (alongside some specialist indexing we are developing in-house, and not part of this question). I expect there to be billions of records stored, so efficient…
Neil Slater
  • 26,512
  • 6
  • 76
  • 94
1
2
3
27 28