Skip to content

Instantly share code, notes, and snippets.

@choplin
Created August 2, 2012 10:32
Show Gist options
  • Save choplin/3236142 to your computer and use it in GitHub Desktop.
Save choplin/3236142 to your computer and use it in GitHub Desktop.
require 'msgpack/rpc'
c = MessagePack::RPC::Client.new('localhost',9090)
c.call(:print, 'hello') #=> サーバー側に'hello'が表示される
c.notify(:print, 'hello') #=> 何も起きない
require 'msgpack/rpc'
class MyHandler
def print(msg)
puts msg
end
end
server = MessagePack::RPC::Server.new
server.listen('localhost', '9090', MyHandler.new)
server.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment