Sha256: 1d3fb4df88e30f4f04008f451e1c0f05326f2a89361eefd6b8a1b305514e7369

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

require 'dripdrop/node'
Thread.abort_on_exception = true

DripDrop::Node.new do
  z_addr = 'tcp://127.0.0.1:2200'
   
  rep = zmq_xrep(z_addr, :bind)
  rep.on_recv do |message,identities,seq|
    puts "REP #{message.body}"
    rep.send_message(message,identities,seq)
  end

  req = zmq_xreq(z_addr, :connect)
  
  i = 0
  k = 0

  zm_reactor.periodical_timer(1000) do
    req.send_message(:name => 'test', :body => "Test Payload i#{i}") do |message|
      puts "RECV I RESP #{message.inspect}"
    end
    req.send_message(:name => 'test', :body => "Test Payload k#{i}") do |message|
      puts "RECV K RESP #{message.inspect}"
    end
  end
end.start!

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dripdrop-0.3.1 example/xreq_xrep.rb
dripdrop-0.3.0 example/xreq_xrep.rb