Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Basic examples of zmq, the Ruby 0mq lib
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.rvmrc
Gemfile
Gemfile.lock
README.md
pub.rb
pull.rb
push.rb
req.rb
res.rb
sub.rb

README.md

0mq from Ruby

A few examples of using 0mq from Ruby via the zmq library.

Starting

gem install bundler
bundle install

Request/Response Example

In separate consoles:

ruby req.rb
ruby res.rb

In the req.rb console, type something and that will be printed in res.rb and then echoed on req.rb.

Push/Pull Example

In separate consoles:

ruby push.rb
ruby pull.rb

In the push.rb console, type something and that will be printed in pull.rb.

Pub/Sub Example

In separate consoles:

ruby pub.rb
ruby sub.rb chan1
ruby sub.rb chan2
ruby sub.rb chan1 chan2

Then in the pub.rb type "chan1 hello", this should appear on any sub.rb hooked up to chan1. Type "chan2 world" and that should appear on any sub.rb hooked up to chan2.

Something went wrong with that request. Please try again.