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

MessagePack implementation for Objective-C

Is there an implementation of the MessagePack protocol for Objective-C? If not, are there examples for bridging the C implementation to Objective-C types?
Bradley Dwyer
  • 8,102
  • 5
  • 32
  • 28
3
votes
0 answers

How to reduce the parsing time of Message pack library when unpacking the huge data

I am using message-pack lib (https://github.com/msgpack/msgpack-java) for an android app and unpacking the data from streaming apis form the received InputStream. The transmission is fast and overall it works good, but the at the client side (i.e.…
3
votes
2 answers

How to resolve ModuleNotFoundError: No module named 'srsly.msgpack.util' in PyInstaller?

I am trying to convert a python script to .exe using PyInstaller. The script is converted to an exe without any error logs. However while running the .exe file am getting ModuleNotFoundError: No module named 'srsly.msgpack.util' The issue is…
Rocky
  • 45
  • 1
  • 10
3
votes
0 answers

Unpack with MessagePackSerializer although there are missing props

I have a web site and the user can search for something. The results are being saved in a session with MessagePackSerializer. Before each search, there is a try to load results from the session by calling MessagePackSerializer Unpack. From time to…
3
votes
1 answer

How to enable LZ4 compression for messagepack content type in Asp.net Core Web API

I'm trying to enable MessagePack content type on a .net Core Web API Project that I'm working on. After some research, Installed this nuget package and added below code in the startup file. Easy enough ! Now I can see msgpack content served through…
Naren
  • 298
  • 2
  • 10
3
votes
2 answers

Avoiding DateTime conversion while passing it to AspNetCore.SignalR .Net client

I am trying to send request from the server to client(.Net) which is running in culture specific environment which affects dates to be in special time zone. I am sending date from the server with Unspecified kind for avoiding it being converted…
3
votes
0 answers

C++ lambdas and closures

I'm replacing...about 6000 lines of deserialization C code with what I hope is about 3000 lines of C++. The basic existing pattern is like so: ser_ret_t msgpack_unpack_mystruct(msgpack_object *obj, mystruct_t *d, void *unused = NULL) { …
zzxyz
  • 2,953
  • 1
  • 16
  • 31
3
votes
0 answers

REGDB_E_CLASSNOTREG when using MsgPack Serializer after application pool recycling

We have a WCF service application hosted in IIS 10. Every time IIS recycles the application pool after 20 minutes of inactivity, we get the following exception when using MsgPack for deserialization: The type initializer for…
Marc
  • 3,905
  • 4
  • 21
  • 37
3
votes
1 answer

Conda build fails due to msgpack dependency (issue with old name - msgpack-python)

I'm trying to build a Python conda package that depends on a pip library (distributed) which depends on msgpack. I keep getting the error that downloading in setuptools is disabled, but I have msgpack (or msgpack-python, i've tried both) listed in…
bschreck
  • 724
  • 7
  • 18
3
votes
1 answer

messagepack with redis where size of data is not big

Redis is a data structure store but still its recommended to use message-pack (or protobuf) to serialize/deserialize data. I am kind of confuse with Messagepack on top of Redis if data chunks written to Redis is not very big. Since, Messagepack…
ryadav
  • 456
  • 5
  • 11
3
votes
1 answer

Unable to read messagepack bytes into Uint8Array buffer in js

I've spend the last hour trying to do a simple hello world with messagepack between Python and Javascript (well, ClojureScript ...). For some reason I can't read the msgpack payload into a javascript buffer correctly. I'm using msgpack-python and…
Marc Claesen
  • 16,778
  • 6
  • 27
  • 62
3
votes
2 answers

Considerations for binary seralizations (Protobuf, CBOR, MessagePack, etc.) for a long term archive data format

In discussions for a next generation scientific data format a need for some kind of JSON-like data structures (logical grouping of fieldshas been identified. Additionally, it would be preferable to leverage an existing encoding instead of using a…
terse
  • 327
  • 2
  • 10
3
votes
1 answer

Unpacking msgpack from respond in python

I get the following error while trying msgpack.unpack: ExtraData: unpack(b) received extra data. Part of my code: r1=requests.get('http://localhost:3000/fs?path='+r.json()['object']) unp = msgpack.unpackb(r1.content) Can someone help with that?
Kamil Kurzyca
  • 31
  • 1
  • 3
3
votes
2 answers

Using msgpack-python with nested namedtuples

My data structure is like this: user = UserTuple( name=u'Anakin', surname=u'Skywalker', birthdate=datetime.date(1981, 7, 25), profile=ProfileTuple(avatar=u'http://localhost/profile.jpg') ) And I want to pack this data with msgpack-python…
yozel
  • 451
  • 1
  • 5
  • 15
3
votes
1 answer

How to compare performance of messagepack-cli and json.net deserializers?

I am trying to compare the performance of two different deserialisation methods in Unity3d, which is based on MonoDevelop's implementation of C# / .NET Method A) Using MsgPack-CLI Method B) Using NewtonSoft's Json.NET Based on this blog post, I was…
songololo
  • 4,724
  • 5
  • 35
  • 49