Class: FeatureHub::Sdk::StreamingEdgeService

Inherits:
EdgeService
  • Object
show all
Defined in:
lib/feature_hub/sdk/streaming_edge_service.rb

Overview

provides a streaming service

Instance Attribute Summary collapse

Attributes inherited from EdgeService

#repository

Instance Method Summary collapse

Constructor Details

#initialize(repository, api_keys, edge_url, logger = nil) ⇒ StreamingEdgeService

Returns a new instance of StreamingEdgeService.



12
13
14
15
16
17
18
# File 'lib/feature_hub/sdk/streaming_edge_service.rb', line 12

def initialize(repository, api_keys, edge_url, logger = nil)
  super(repository, api_keys, edge_url, logger)

  @url = "#{edge_url}features/#{api_keys[0]}"
  @sse_client = nil
  @context = nil
end

Instance Attribute Details

#sse_clientObject (readonly)

Returns the value of attribute sse_client.



10
11
12
# File 'lib/feature_hub/sdk/streaming_edge_service.rb', line 10

def sse_client
  @sse_client
end

#stoppedObject (readonly)

Returns the value of attribute stopped.



10
11
12
# File 'lib/feature_hub/sdk/streaming_edge_service.rb', line 10

def stopped
  @stopped
end

#urlObject (readonly)

Returns the value of attribute url.



10
11
12
# File 'lib/feature_hub/sdk/streaming_edge_service.rb', line 10

def url
  @url
end

Instance Method Details

#activeObject



28
29
30
# File 'lib/feature_hub/sdk/streaming_edge_service.rb', line 28

def active
  !@sse_client.nil?
end

#closeObject



32
33
34
# File 'lib/feature_hub/sdk/streaming_edge_service.rb', line 32

def close
  close_connection
end

#closedObject



20
21
22
# File 'lib/feature_hub/sdk/streaming_edge_service.rb', line 20

def closed
  @sse_client.nil?
end

#pollObject



24
25
26
# File 'lib/feature_hub/sdk/streaming_edge_service.rb', line 24

def poll
  start_streaming unless @sse_client || @stopped
end