Sha256: 377764413804b322819d0173497852282bc818a76a98b6498723bfc7047b68cc

Contents?: true

Size: 353 Bytes

Versions: 9

Compression:

Stored size: 353 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony/http'

$throttler = throttle(1000)
opts = { reuse_addr: true, dont_linger: true }
spin do
  Polyphony::HTTP::Server.serve('0.0.0.0', 1234, opts) do |req|
    $throttler.call { req.respond("Hello world!\n") }
  end
end

puts "pid: #{Process.pid}"
puts 'Listening on port 1234...'

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
polyphony-http-0.28 examples/http_server_throttled.rb
polyphony-http-0.27 examples/http_server_throttled.rb
polyphony-http-0.26 examples/http_server_throttled.rb
polyphony-http-0.25 examples/http_server_throttled.rb
polyphony-http-0.24 examples/http_server_throttled.rb
polyphony-0.23 examples/http/http_server_throttled.rb
polyphony-0.22 examples/http/http_server_throttled.rb
polyphony-0.21 examples/http/http_server_throttled.rb
polyphony-0.20 examples/http/http_server_throttled.rb