<commit_before>require 'dripdrop/node'
Thread.abort_on_exception = true

DripDrop::Node.new do
  z_addr = 'tcp://127.0.0.1:2200'
   
  zmq_xrep(z_addr, :bind).on_recv do |message,response|
    puts "REP #{message.body}"
    response.send_message(message)
  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!<commit_msg>Better xreq/xrep example<commit_after>require 'dripdrop/node'
Thread.abort_on_exception = true

DripDrop::Node.new do
  route :xrep_server, :zmq_xrep, 'tcp://127.0.0.1:2200', :bind
  route :xreq_client, :zmq_xreq, xrep_server.address,    :connect
   
  xrep_server.on_recv do |message,response|
    puts "REP #{message.body}"
    response.send_message(message)
  end

  i = 0; k = 0
  zm_reactor.periodical_timer(1000) do
    i += 1; k += 1
     
    xreq_client.send_message(:name => 'test', :body => "Test Payload i#{i}") do |message|
      puts "RECV I RESP #{message.inspect}"
    end
    xreq_client.send_message(:name => 'test', :body => "Test Payload k#{i}") do |message|
      puts "RECV K RESP #{message.inspect}"
    end
  end
end.start!
{'fraction_non_alphanumeric': 0.1501072194424589, 'fraction_numerical': 0.024303073624017155, 'mean_word_length': 3.5751633986928106, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7516759', 'n_tokens_mistral': 558, 'n_tokens_neox': 549, 'n_words': 121}