Skip to content

Instantly share code, notes, and snippets.

@meetme2meat
Last active Jan 28, 2016
Embed
What would you like to do?
This is 2nd Client for Celluloid example
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-2 so that server does not go in sleep mode.
client.write('client-2')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment