Skip to content

Instantly share code, notes, and snippets.

@andrewvc
Created October 8, 2010 15: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 andrewvc/616962 to your computer and use it in GitHub Desktop.
Save andrewvc/616962 to your computer and use it in GitHub Desktop.
#New Style:
DripDrop::Node.new
addr = 'tcp://127.0.0.1:2222';
zmq_sub(addr,:bind) do |message|
end
pub = zmq_pub(addr,:connect)
pub.send_message(:name => 'test', :body => 'hi')
end.start!
#Much better than the old style (which should still work)...
DripDrop::Node.new do |node|
addr = 'tcp://127.0.0.1:2222';
node.zmq_sub(addr,:bind) do |message|
end
node.pub = zmq_pub(addr,:connect)
pub.send_message(DripDrop::Message.new('test', :body => 'hi'))
end.start!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment