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

Azure Redis Messagepack-csharp Out of memory exception

Using: .NET Core 2.1.x StackExchange.Redis.Extensions 4.0.5 messagepack c-sharp 2.3.85 Azure Redis Azure app service Hello, i am not sure it is a bug in the messagepack-csharp library,but i have the following problem and hopefully somebody can…
mkeymolen
  • 196
  • 1
  • 3
  • 14
0
votes
1 answer

How to use unpacked data msgpack-c

I know how to unpack data but don't know how to use specific data from array or map, Here's the code : #include #include int main(void) { /* msgpack::sbuffer is a simple buffer implementation. */ msgpack_sbuffer sbuf; …
Lukkyz
  • 44
  • 5
0
votes
1 answer

Jetty17 --add-opens option does not work, java.lang.IllegalAccessError

I use Java 17 with Jetty 11.0.9. I started Jetty with the following command java --add-opens=java.base/java.lang=ALL-UNNAMED -jar start.jar Then I am facing exception followings. 2022-05-06 16:40:45.314:WARN :oejw.WebAppContext:main: Failed startup…
takezaki
  • 21
  • 1
  • 4
0
votes
1 answer

MessagePack how to write a stream of serialized structs to / from a BufWriter/BufReader

I'm writing a giant stream of messages (from a websocket feed) to a file. The messages look like this, an enum of structs that are themselves serializable. enum SerializedMessage { Level2(Level2), Full(Full), Match(Match), …
nxstock-trader
  • 223
  • 2
  • 6
0
votes
1 answer

"is not registered in resolver" exception when serializing with abstract class using MessagePack

Trying to serialize componentMappers . The Exception is throwed at .Serialize(): var componentMappers = new Bag(); var componentMappersS = MessagePackSerializer.Serialize(componentMappers); var componentMappersD =…
dclipca
  • 1,739
  • 1
  • 16
  • 51
0
votes
1 answer

Narrow unknown type to generic type parameter

I have a function to call a web socket that returns a serialized result, which is then deserialized. The resulting type of the deserialization (with msgpack) is unknown. Thus I want to provide a generic type parameter for the calling function, so…
Jost
  • 199
  • 1
  • 3
  • 16
0
votes
1 answer

Incorrect reflection after inheritance-involved serialization with MessagePack

I am serializing an Entity on a server: public class Entity { private List _components = new List(); [Key(0)] public List Components { get { return…
dclipca
  • 1,739
  • 1
  • 16
  • 51
0
votes
1 answer

MessagePack subtype serialization

Serialization/deserialization turns a collection of a base type with child-type items in it into a collection with base type items only. Is there a way to set up the process so items would end up of the exact same type? Tried various resolvers to no…
L1oN
  • 25
  • 6
0
votes
1 answer

serialization/deserialization of Node JS "undefined" in other languages

I'm serializing some data using message pack(@msgpack/msgpack) on a Node JS server and passing the serialized data via an HTTP communication to another software that is written in C++. My question is, what would a deserialized js "undefined" object…
Reza Fathy
  • 19
  • 1
  • 4
0
votes
1 answer

Msgpack::object to JSON string C++

My code looks like following: msgpack::unpacked msg; msgpack::unpack(msg, args.data(), args.size()); msgpack::object obj = msg.get(); // How to convert "obj" to JSON string format here? And I want to convert that object to a JSON string. How can…
0
votes
1 answer

ModuleNotFoundError: No module named 'msgpack', but msgpack is already installed

I'm on Windows using PowerShell and I'm trying to run a python script that calls another script that imports msgpack. My msgpack version is 1.0.2. > python3 .\testing.py Traceback (most recent call last): File "C:\\testing.py", line 1, in…
0
votes
1 answer

How do i access data from redis encoded wth msgpack?

I've got some enc_data with msgpack coming from redis. I've set up my sentinel and connection as follow: sentinel = Sentinel([('localhost','26379')], decode_responses=False) conn = sentinel.master_for('foo', socket_timeout=0.5,…
Verthais
  • 300
  • 3
  • 14
0
votes
1 answer

Messagepack "partial" serialization

I have a class with some private and public fields and properties. [MessagePackObject(false)] public class Person { [Key(1)] public string Name { get; set; } [IgnoreMember] private int _age; [Key(2)] public int Age { get {…
Gor Asatryan
  • 904
  • 7
  • 24
0
votes
1 answer

SignalR MessagePack Polymorphism

I am implementing a system based on SignalR that will be pushing client events, for message serialization I would want to use MessagePack. When trying to implement the messaging I have run into a problem where SignalR fails to deserialize the…
NullReference
  • 862
  • 1
  • 11
  • 27
0
votes
0 answers

How to combine data in msgpack format?

There is a struct name Model defined as follows: struct Model { 1: string a, 2: string b, 3: long c } And I have only string serialized from Model at remote computer as follows, when I can't see definition above. Model m1; m1.set_a("a"); …
Tonii-xx
  • 73
  • 5