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

Switch from BinaryFormatter serialization without changing much: big data and circular references

In our application which is maintained for years we use BinaryFormatter serialization of big data objects containing loads of collections and circular references. Serialization takes almost forever (~20 seconds) and takes much of CPU usage. I'd like…
Mike G
  • 185
  • 5
  • 17
-2
votes
1 answer

Invalid Object Name When Referencing CTE Multiple Times

I get the following error message when I run the code below and I can't see why. The code builds two chained CTEs and then runs SELECT statements against them. Msg 208, Level 16, State 1, Line 76 Invalid object name 'FFCSource' WITH FFCChildDemo…
-2
votes
1 answer

different static linking ways of gcc cause different compilation results

I use msgpack-c 1.0.0, when I compile the following program it failed: #include #include int main(void) { /* creates buffer and serializer instance. */ msgpack_sbuffer* buffer = msgpack_sbuffer_new(); …
1 2 3
27
28