method
periodically
v7.0.0 -
Show latest stable
- Class:
ActionCable::Channel::PeriodicTimers::ClassMethods
periodically(callback_or_method_name = nil, every:, &block)public
Periodically performs a task on the channel, like updating an online user counter, polling a backend for new status messages, sending regular “heartbeat” messages, or doing some internal work and giving progress updates.
Pass a method name or lambda argument or provide a block to call. Specify the calling period in seconds using the every: keyword argument.
periodically :transmit_progress, every: 5.seconds periodically every: 3.minutes do transmit action: :update_count, count: current_count end