README.md in ezmq-0.3.7 vs README.md in ezmq-0.4.0

- old
+ new

@@ -23,11 +23,13 @@ ``` require 'ezmq' server = EZMQ::Server.new -server.listen +server.listen do |message| + message +end ``` Synchronous Client Request -------------------------- Sends a message, prints the reply when it arrives. @@ -60,11 +62,13 @@ ``` require 'ezmq' require 'json' server = EZMQ::Server.new encode: -> m { JSON.dump m }, decode: -> m { JSON.load m } -server.listen +server.listen do |message| + message +end ``` JSON Synchronous Client Request ------------------------------- Encodes a message in JSON, sends it twice, prints the first one raw, and decodes the second. @@ -99,11 +103,13 @@ ``` require 'ezmq' subscriber = EZMQ.Subscriber.new topic: 'foorever' -subscriber.listen +subscriber.listen do |message, topic| + puts "[#{ topic }] #{ message }" +end ```` Pipeline Work Generator ------------------------ Generates work, distributes it to workers via PUSH socket. @@ -157,12 +163,14 @@ ``` require 'ezmq' require 'json' collector = EZMQ::Puller.new port: 5556 -collector.listen +collector.listen do |message| + puts message +end ``` - + Operating System Notes ====================== As this relies on [ffi-rzmq](https://github.com/chuckremes/ffi-rzmq), you will need to have the zeromq libraries available.