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/f32f9319bd25152f9150 to your computer and use it in GitHub Desktop.
Save meetme2meat/f32f9319bd25152f9150 to your computer and use it in GitHub Desktop.
Celluloid Client-1.
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