Skip to content

Instantly share code, notes, and snippets.

@mokevnin
Created September 22, 2011 12:22
Show Gist options
  • Save mokevnin/1234648 to your computer and use it in GitHub Desktop.
Save mokevnin/1234648 to your computer and use it in GitHub Desktop.
# pub.rb
require 'rubygems'
require 'zmq'
context = ZMQ::Context.new
chan = ARGV[0]
pub = context.socket ZMQ::PUB
pub.bind 'tcp://*:5555'
while msg = STDIN.gets
msg.strip!
pub.send "#{chan} #{msg}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment