From 788f6dba2014c6c27ef4f84b2a6d4839e7cff749 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 11 Oct 2021 09:56:59 +0200 Subject: [PATCH] Specify TLS certificate for Faye::WebSocket::Client --- lib/runner/connection.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/runner/connection.rb b/lib/runner/connection.rb index addd22fd..002331d1 100644 --- a/lib/runner/connection.rb +++ b/lib/runner/connection.rb @@ -13,7 +13,11 @@ class Runner::Connection attr_reader :error def initialize(url, strategy, event_loop, locale = I18n.locale) - @socket = Faye::WebSocket::Client.new(url, [], ping: 5) + # The `ping` value is measured in seconds and specifies how often a Ping frame should be sent. + # Internally, Faye::WebSocket uses EventMachine and the `ping` value is used to wake the EventMachine thread + # The `tls` option is used to customize the validation of TLS connections. + # Passing `nil` as a `root_cert_file` is okay and done so for the DockerContainerPool. + @socket = Faye::WebSocket::Client.new(url, [], ping: 0.1, tls: {root_cert_file: Runner.strategy_class.config[:ca_file]}) @strategy = strategy @status = :established @event_loop = event_loop