Skip to content

Instantly share code, notes, and snippets.

@meetme2meat
Last active January 28, 2016 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meetme2meat/1963a8e23f5db59af091 to your computer and use it in GitHub Desktop.
Save meetme2meat/1963a8e23f5db59af091 to your computer and use it in GitHub Desktop.
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