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