Sha256: d24e22b5e5c726dee0e0ce84ea90edd1a0e73835da5dbc667bcd189703a06ced

Contents?: true

Size: 457 Bytes

Versions: 2

Compression:

Stored size: 457 Bytes

Contents

$: << '../lib' << 'lib'

require 'ZMachine'
require 'z-http'

ZMachine.run {
  multi = ZMachine::MultiRequest.new

  reqs = [
    'http://google.com/',
    'http://google.ca:81/'
  ]

  reqs.each_with_index do |url, idx|
    http = ZMachine::HttpRequest.new(url, :connect_timeout => 1)
    req = http.get
    multi.add idx, req
  end

  multi.callback  do
    p multi.responses[:callback].size
    p multi.responses[:errback].size
    ZMachine.stop
  end
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
z-http-request-0.2.0 examples/multi.rb
z-http-request-0.1.0 examples/multi.rb