Sha256: 32cd6a0e127aa7551c6a9d613a9f56083ec072e67c0fef90e7ec95842405e75e

Contents?: true

Size: 900 Bytes

Versions: 29

Compression:

Stored size: 900 Bytes

Contents

#!/usr/bin/env ruby

Thread.abort_on_exception = true

require 'kontena-websocket-client'
require_relative './benchmark'

WEBSOCKET_OPTIONS = {
  connect_timeout: 1.0,
  open_timeout: 1.0,
  ping_timeout: 1.0,
  ping_interval: nil,
  write_timeout: 5.0,
}

Kontena::Websocket::Logging.initialize_logger(STDERR, LOG_LEVEL)

run_benchmark do |url, **options|
  send_thread = nil
  reader = BenchmarkReader.new

  Kontena::Websocket::Client.connect(url, **WEBSOCKET_OPTIONS) do |client|
    $logger.info "connect: #{client}"

    send_thread = Thread.new {
      send_stats = benchmark_sender(**options) do |msg, seq|
        client.send(msg)
      end

      client.close()

      send_stats
    }

    reader.start()
    client.read do |message|
      reader.on_message(Time.now, message)
    end
  end

  read_stats = reader.stop()
  send_stats = send_thread.value

  next send_stats, read_stats
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
kinetic_sdk-5.0.19 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.18 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.17 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.16 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.15 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.14 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.13 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.12 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.11 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.10 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.9 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.8 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.7 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.6 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.5 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.4 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.3 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.2 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.2.beta.4 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb
kinetic_sdk-5.0.2.beta.3 gems/kontena-websocket-client-0.1.1/benchmark/benchmark-client.rb