Class: SplitIoClient::SSE::NotificationManagerKeeper
- Inherits:
-
Object
- Object
- SplitIoClient::SSE::NotificationManagerKeeper
- Defined in:
- lib/splitclient-rb/sse/notification_manager_keeper.rb
Instance Method Summary collapse
- #handle_incoming_occupancy_event(event) ⇒ Object
-
#initialize(config) {|_self| ... } ⇒ NotificationManagerKeeper
constructor
A new instance of NotificationManagerKeeper.
- #on_action(&action) ⇒ Object
Constructor Details
#initialize(config) {|_self| ... } ⇒ NotificationManagerKeeper
Returns a new instance of NotificationManagerKeeper.
8 9 10 11 12 13 14 15 16 |
# File 'lib/splitclient-rb/sse/notification_manager_keeper.rb', line 8 def initialize(config) @config = config @publisher_available = Concurrent::AtomicBoolean.new(true) @publishers_pri = Concurrent::AtomicFixnum.new @publishers_sec = Concurrent::AtomicFixnum.new @on = { action: ->(_) {} } yield self if block_given? end |
Instance Method Details
#handle_incoming_occupancy_event(event) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/splitclient-rb/sse/notification_manager_keeper.rb', line 18 def handle_incoming_occupancy_event(event) if event.data['type'] == 'CONTROL' process_event_control(event.data['controlType']) else process_event_occupancy(event.channel, event.data['metrics']['publishers']) end rescue StandardError => e @config.logger.error(e) end |
#on_action(&action) ⇒ Object
28 29 30 |
# File 'lib/splitclient-rb/sse/notification_manager_keeper.rb', line 28 def on_action(&action) @on[:action] = action end |