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
2
votes
1 answer

How to dissect UDP msgpack using Wireshark/tshark?

Since v3.0.0 Wireshark supports msgpack. I have a capture file containing msgpack messages encapsulated in UDP I want to dissect. The problem is that when I'm running: tshark -r 1.pcap -d udp.port==60003,msgpack I get following message: tshark:…
Alexey R.
  • 183
  • 5
2
votes
1 answer

how to unpack many msgpack data from one file chunk

I am wondering is it possible to unpack more than one msgpack object from a file chunk? In the example code below I wrote 2 msgpack object to a file, when I read back, if I specify the correct size, I can unpack them without problem. if I read the…
dli
  • 1,173
  • 3
  • 14
  • 21
2
votes
3 answers

Error when loading a custom model with spacy

I'm trying to load a custom model called 'ru2' into spacy (for npl processing). it can be found there: https://github.com/buriy/spacy-ru The problem is when I call the function nlp = spacy.load('ru2') doc = nlp(text) I see the error…
Luxor
  • 351
  • 1
  • 3
  • 17
2
votes
1 answer

What is the Rust equivalent of a JavaScript object when encoding with msgpack?

I'm trying to port a JavaScript library which uses msgpack for encoding JavaScript objects to Rust. I found a Rust library for msgpack encoding/decoding, but I don't get what is the equivalent input format in Rust. This JavaScript code for encoding…
pd176
  • 821
  • 3
  • 10
  • 20
2
votes
2 answers

Convert from and to messagepack

So I'm trying to get the string representation of a JSON message in Golang. I just want to receive the messagepack encoded JSON, modify some values and send it back. I haven't found an easy way to do it. Most of the times, I can't know in advance…
2
votes
1 answer

Java - convert MessagePack timestamp to date

I'm decoding a MessagePack message from an Apache Beam pipeline in a Java project. I'm using Maven to import the MessagePack library as dependency: org.msgpack msgpack-core
Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206
2
votes
1 answer

MessagePack deserialize exception in inherited class from Dictionary<,>

Hi I have a class like : public class Event : Dictionary AttributeType is enum Deserializing will throw an exception var @event = new Event { { AttributeType.EventId, Guid.NewGuid() }…
Hesam Faridmehr
  • 1,176
  • 8
  • 20
2
votes
1 answer

insert NULL values in tarantool using python

i'm having troubles with storing data in tarantool. In documentation stated that tarantool uses msgpack Data Types(https://tarantool.io/doc/1.7/book/box/data_model.html#data-types) . Msgpack has NULL, however python does not have NULL, also it seems…
UGeorge
  • 101
  • 2
  • 8
2
votes
1 answer

Updating Angular 5 to 6.rc0 causes packing issues

I currently try to update from angular 5 to 6.rc0. I changed my package json to look like that: { "name": "angular5to6", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build…
2
votes
0 answers

MsgPack for communication between C# and Java

I will be doing some work on C# side using MessagePack and I have learned that I can send a request by serializing/packing it first by using MsgPack API and then converting the serialized/packed object into a byte[], to a Java restful service. And…
user2913184
  • 590
  • 10
  • 33
2
votes
1 answer

Install msgpack (0.5.8) using homebrew mac OSX error

I've been trying to install msgpack using homebrew, and it repeatedly throw the following error: Building native extensions. This could take a while... ERROR: Error installing msgpack: ERROR: Failed to build gem native extension. current…
nilesguo
  • 162
  • 1
  • 14
2
votes
2 answers

MessagePack C++ - How to iterate through an unknown data structure?

I want to share structured data between C++ and Python languages using MessagePack like this one: { "t" : [ [t00,...,t0N], ... , [tM0,...,tMN] ], "x" : [ x0,..,xN], "P" : [ [P00, ..., P0N], ..., [PM0,...,PMN] ] } The number of variables is…
2
votes
2 answers

decode msgpack in redis lua

public class MsgPackInRedis { private String ip; private int port; private String session; private String protocol; } MsgPackInRedis msgPackStringInRedis = new MsgPackInRedis(); I encode a java object msgPackStringInRedis of class…
2
votes
1 answer

How to serialize subtypes with MsgPack in C#

i have a question regarding msgpack serialization in c#. I have a base class and a class derived from base, each of them holding properties, for example: class Base { int PropertyA { get; set; } } class DerivedFromBase : Base { int…
Robert_Jordan
  • 256
  • 4
  • 13
2
votes
1 answer

msgpack C# -> kafka -> consumer (kafka-python) fails with ExtraData: unpack(b) received extra data

I'm trying to decode msgpack encoded binary message received from Kafka stream and get the following exception inside Python repl. ExtraData: unpack(b) received extra data. In [32]: message.value Out[32]:…
DmitrySemenov
  • 9,204
  • 15
  • 76
  • 121