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

Can I send an RMPV `Value` back to rmp_serde for deserialization?

I have a large, somewhat complicated data structure that I can serialize and deserialize with serde and rmp-serde, but I find that deserialization is quite slow. I think this is because my data structure includes two rather large HashMaps. I don't…
user655321
  • 1,572
  • 2
  • 16
  • 33
0
votes
1 answer

How to compute size of MessagePack .NET object?

If I have a class without any variable sized objects (e.g. strings, lists, etc.), is there some utility function in the MessagePack library to compute the size of the binary representation of the object? Example class: [MessagePackObject] class Foo…
HelloWorld
  • 3,381
  • 5
  • 32
  • 58
0
votes
0 answers

msgpack c++ unable to write to pipe

I have read a lot about the msgpack over the net, but couldn't find any help regarding this issue. #include int main(){ struct item { std::time_t currentTime; std::map base; }; struct obj { …
ccoding
  • 1
  • 2
  • 8
0
votes
0 answers

msgpack - configure messagepack without attribute

I want to use msgpack to submit data between c# and javascript. Problem is I cannot add attributes to the classes. Is there a way to configure msgpack without using attributes?
Jochen Kühner
  • 1,385
  • 2
  • 18
  • 43
0
votes
0 answers

msg pack scipy ckdtree - build custom serializer

I need to custom serialize a ckdtree object with message pack since it is not serializeble by default. from scipy.spatial.ckdtree import cKDTree with open(msgpack_file, 'wb') as f: msgpack.dump(tree, f) TypeError: Cannot serialize…
El Dude
  • 5,328
  • 11
  • 54
  • 101
0
votes
0 answers

Using System.Linq.Async.ToAsyncEnumerable with SignalR and MessagePack

I've been experimenting with SignalR streaming, and I've run across a problem (albeit with a workaround), but I wonder if there's anything I can do to make this work. I'm trying to send a SignalR request with a large amount of data, so switched to…
0
votes
1 answer

How can one configure and use MessagePack in an asp.net core 3.1 web api?

I have followed this article to start using MessagePack in my asp.net core 3.1 application but it's not working due to the following error message: Severity Code Description Project File Line Suppression State Error CS1503 Argument 1:…
Arash
  • 3,628
  • 5
  • 46
  • 70
0
votes
1 answer

How to sink MessagePack-encoded messages into MongoDB from Kafka

I have a Kafka topic where the values are MessagePack-encoded. Is there any way to sink the records from this topic into MongoDB using the MongoDB Kafka connector, or must the record values simply be stored as JSON?
0
votes
1 answer

Unpacking objects individually from a TCP stream

I would like to read one by one the objects coming from a TCP stream, preferably using the MessagePack library. On one side I have a client that, at each iteration of a loop: computes a point location (tuple) packs that location and sends it…
solub
  • 1,291
  • 17
  • 40
0
votes
0 answers

Message pack throws an error when calling Signalr Client method can't find matched constructor. type:Newtonsoft.Json.Linq.JProperty

I have a signalr application with the message pack protocol enabled. When the client connecting to my hub has message-pack enabled, everything works well, When I call a client (With message pack disabled) method passing as parameter an object…
Damien Doumer
  • 1,991
  • 1
  • 18
  • 33
0
votes
1 answer

Extracting MsgPack from String of bytes - rust

I am trying to write a wrapper function for read a string that contains Vec[u8] (that are really just MsgPacks) and convert them to native rust structs, my code looks like this use rmp_serde::{decode, from_slice}; use…
asosnovsky
  • 2,158
  • 3
  • 24
  • 41
0
votes
1 answer

pip msgpack error while installing requirements

I used pip install -r requirements.txt, and got this error: AttributeError: module 'msgpack' has no attribute 'dumps' Full log: https://pastebin.com/aTTwyrML requirements.txt:…
R Harrington
  • 253
  • 2
  • 10
0
votes
1 answer

How to unpack CHIME/FRB data files?

Depiction of a Fast Radio Burst I have an issue with the msgpack.py which has to be used to read and uncompress the msgpack data. Here is the location of the files which I'm trying to uncompress CHIME/FRB data files. Here is additional information…
Newbie
  • 3
  • 2
0
votes
1 answer

ArduinoJSON serialization returns an empty string when serializing to char*

I made a function that serializes settings and returns a char* containing serialized data. First i'm packing all the values into a StaticJsonDocument, then determining size of the output string using measureJson, then allocating space for the output…
EntityinArray
  • 109
  • 12
0
votes
0 answers

How to build a Java Microservices architecture with MessagePack

I've recently discovered MessagePack, which seems to be an interesting alternative to JSONs. If I'd like to use it in a Java Microservices Architecture, how can I make microservices talk between each other? Currently, I'm using the following…
Gianmarco F.
  • 780
  • 2
  • 12
  • 36