Version 7 by Kazuki Ohta
on Apr 03, 2011 18:30.

compared with
Current by Tim Lossen
on Jan 05, 2012 20:16.

(show comment)
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (7)

View Page History

h1. Install

You can install MessagePack for Ruby using RubyGems. Ruby 1.8.6 or higher (including Ruby 1.9) is required.

{code}

There is also a version for JRuby, which uses native Java:
{code}
$ gem install msgpack-jruby
{code}
You can install MessagePack-RPC for Ruby using RubyGems.

src = ["Hello", "World", 1, 2, 3]
binary = MessagePack.pack(src)

dst = MessagePack.unpack(binary)
p dst #=> ["Hello", "World", 1, 2, 3]
{code}
require 'msgpack'

# Open the log file for write.
File.open("log.mpac", "w") do |f|
{'name'=>'frsyuki'}.to_msgpack(f)
end

# Open the log file for read.
File.open("log.mpac") do |f|
{code}
require 'msgpack/rpc'

class MyHandler
def add(a, b)
end
end

svr = MessagePack::RPC::Server.new
svr.listen('0.0.0.0', 9090, MyHandler.new)