From 5849f1c4639509064a1d1b3f5bd0c59ac0f73d38 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 29 Oct 2020 00:40:36 +0100 Subject: [PATCH] Add ping for Faye WebSocket to Docker --- lib/docker_client.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/docker_client.rb b/lib/docker_client.rb index d35a2849..11cf93b3 100644 --- a/lib/docker_client.rb +++ b/lib/docker_client.rb @@ -88,7 +88,9 @@ class DockerClient headers = {'Origin' => 'http://localhost'} socket_url = DockerClient.config['ws_host'] + '/v1.27/containers/' + @container.id + '/attach/ws?' + query_params - socket = Faye::WebSocket::Client.new(socket_url, [], headers: headers) + # 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 + socket = Faye::WebSocket::Client.new(socket_url, [], headers: headers, ping: 0.1) Rails.logger.debug 'Opening Websocket on URL ' + socket_url