Questions tagged [messagepack]

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.

http://msgpack.org/

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
72 questions
0
votes
1 answer

msgpack / messagepack not serializing php

I am attempting to access session variables set via php stored in memcached from node. I would really like the format of the stored session data to be in JSON. I found msgpack and that looked like it might do the job, however, a console.log of the…
Grant
  • 105
  • 8
0
votes
2 answers

Can't compile msgpack Python extension under windows

When I try to compile msgpack under windows with visual studio 2008 professional version by doing Python setup.py build I get msgpack/_packer.cpp(316) : fatal error C1083: Cannot open include file: 'stdint. h': No such file or…
mahonya
  • 9,247
  • 7
  • 39
  • 68
0
votes
0 answers

How to invoke client's callback at server end?

RPC do things like this: server define a function foo_max(para) client call foo_max, send 'max+para' server get 'max' and call foo_max(para) server send return val client get result and return But this way is not flexible because I must define all…
xunzhang
  • 2,838
  • 6
  • 27
  • 44
0
votes
1 answer

Pass Object class to server method using Message Pack RPC

I want to make a call from a client to a method in the server and I want to pass to the method an argument that is a class written by me. How can I do this using MsgPack RPC. I know how to pass an int a vector or a string.
exilonX
  • 1,712
  • 3
  • 26
  • 50
0
votes
1 answer

Logging Multiple JSON Objects to a Single File - File Format

I have a solution where I need to be able to log multiple JSON Objects to a file. Essentially doing one log file per day. What is the easiest way to write (and later read) these from a single file? How does MongoDB handle this with BSON? What does…
BuddyJoe
  • 69,735
  • 114
  • 291
  • 466
0
votes
1 answer

How should two servers communicate

For a new project I need to design a multi-component back end in Python. Initially, it will have two basic components -- a business rules server and a front end that will serve the requests coming from the browser. |--------------------| …
treecoder
  • 43,129
  • 22
  • 67
  • 91
0
votes
1 answer

MsgPack could not messagepack NSData object

Trying to set an image data NSData *thumbnailData = UIImageJPEGRepresentation(place.thumbnail, 0.8); [placeDict setObject:thumbnailData forKey:thumbnail]; And getting error: Could not messagepack object: External Data Reference:
Shmidt
  • 16,436
  • 18
  • 88
  • 136
0
votes
1 answer

BSON to Messagepack

The problem that I am facing is that BSON comes with ObjectId and Timestamp which are not supported in Messagepack and it aint possible to define a custom serializer for Messagepack (at least as far as I know). I wrote a piece of python code to…
Jermin Bazazian
  • 1,932
  • 2
  • 17
  • 20
0
votes
1 answer

Serializing object using messagepack and as3

This is a vary simple question, but can't find any docs on it. I have a simple class: public class User { public var name:String; public var age:int; } I would like to serialize it using this: var user:User = new User(); user.age =…
Mike Z
  • 1,467
  • 2
  • 14
  • 16
0
votes
3 answers

MessagePack template lookup causing stuck threads in WebLogic?

We're using MessagePack 0.6.6 for Java in Grails 2.0 on WebLogic 11g (10.3) to serialize string data... public void serialize(Object object, OutputStream outputStream) throws IOException { byte[] bytes = MessagePack.pack(object); …
raffian
  • 31,267
  • 26
  • 103
  • 174
0
votes
1 answer

create debug version of python package python-msgpack for Ubuntu

I need a version of messagepack that i can use with python2.7-dbg. How would I go about creating one? for reference I've asked via an issue on github https://github.com/msgpack/msgpack-python and here's a little context python-dbg can't find…
Hunter Barrington
  • 143
  • 1
  • 1
  • 11
-1
votes
1 answer

MessagePack Perl to C++ deserialisation

I'm new to messagepack, and I'm trying to take a hash in perl, serialize it using messagepack, write it to a file, pass that to c++ code where the file is read and deserialized into a map. My perl code to generate the file is (note - I added an…
rbennett485
  • 1,907
  • 15
  • 24
1 2 3 4
5