Last active
January 28, 2016 12:24
-
-
Save meetme2meat/f32f9319bd25152f9150 to your computer and use it in GitHub Desktop.
Celluloid Client-1.
This file contains hidden or 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 'celluloid/zmq' | |
Celluloid::ZMQ.init | |
class Client | |
include Celluloid::ZMQ | |
def initialize | |
@socket = Socket::Push.new | |
begin | |
@socket.connect('tcp://192.168.1.10:3435') | |
rescue IOError | |
@socket.close | |
raise | |
end | |
end | |
def write(message) | |
@socket.send(message) | |
nil | |
end | |
end | |
client = Client.new() | |
## pass client-1 so that server goes to sleep. | |
client.write('client-1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment