From e58c181a039c659fdef02946456a84f0351b0564 Mon Sep 17 00:00:00 2001 From: Kirill Usanov Date: Fri, 18 Apr 2025 09:54:55 +0300 Subject: [PATCH] Add thread reader to client --- lib/ld-eventsource/client.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ld-eventsource/client.rb b/lib/ld-eventsource/client.rb index 6355a62..cdb58ea 100644 --- a/lib/ld-eventsource/client.rb +++ b/lib/ld-eventsource/client.rb @@ -141,9 +141,12 @@ def initialize(uri, yield self if block_given? - Thread.new { run_stream }.name = 'LD/SSEClient' + @thread = Thread.new { run_stream } + @thread.name = 'LD/SSEClient' end + attr_reader :thread + # # Specifies a block or Proc to receive events from the stream. This will be called once for every # valid event received, with a single parameter of type {StreamEvent}. It is called from the same