Created
August 2, 2012 10:32
-
-
Save choplin/3236142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'msgpack/rpc' | |
c = MessagePack::RPC::Client.new('localhost',9090) | |
c.call(:print, 'hello') #=> サーバー側に'hello'が表示される | |
c.notify(:print, 'hello') #=> 何も起きない |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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