Class: Logux::ChannelController
Instance Attribute Summary
#action, #meta
Instance Method Summary
collapse
#initialize, #node_id, #respond, unverify_authorized!, #user_id, verify_authorized!
Instance Method Details
#initial_data ⇒ Object
9
10
11
|
# File 'lib/logux/channel_controller.rb', line 9
def initial_data
[]
end
|
13
14
15
|
# File 'lib/logux/channel_controller.rb', line 13
def initial_meta
{ clients: [meta.client_id] }
end
|
#since_time ⇒ Object
17
18
19
20
21
22
|
# File 'lib/logux/channel_controller.rb', line 17
def since_time
@since_time ||= begin
since = action[:since]&.send(:[], :time)
Time.at(since).to_datetime if since
end
end
|
#subscribe ⇒ Object
5
6
7
|
# File 'lib/logux/channel_controller.rb', line 5
def subscribe
Logux.add_batch(initial_data.map { |d| [d, initial_meta] })
end
|