Class: Pollen::Executor
- Inherits:
-
Object
- Object
- Pollen::Executor
- Defined in:
- lib/pollen/server.rb
Instance Method Summary collapse
- #accept(connection) ⇒ Object
-
#initialize ⇒ Executor
constructor
A new instance of Executor.
- #push(stream_id, event, data) ⇒ Object
- #start! ⇒ Object
Constructor Details
Instance Method Details
#accept(connection) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/pollen/server.rb', line 26 def accept(connection) Rails.logger.info "Creating connection for stream #{connection.stream_id}" @mutex.synchronize do @incoming << connection end end |
#push(stream_id, event, data) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/pollen/server.rb', line 19 def push(stream_id, event, data) Rails.logger.info "Pushing data for stream #{stream_id}, event: #{event}" @mutex.synchronize do @events[stream_id] = { event:, data: } end end |
#start! ⇒ Object
12 13 14 15 16 17 |
# File 'lib/pollen/server.rb', line 12 def start! @thread = Thread.new do start_loop end self end |