module ActionCable::Channel::PeriodicTimers::ClassMethods

def periodically(callback_or_method_name = nil, every:, &block)


end
transmit action: :update_count, count: current_count
periodically every: 3.minutes do

periodically :transmit_progress, every: 5.seconds

keyword argument.
Specify the calling period in seconds using the every:
Pass a method name or lambda argument or provide a block to call.

progress updates.
regular "heartbeat" messages, or doing some internal work and giving
user counter, polling a backend for new status messages, sending
Periodically performs a task on the channel, like updating an online
def periodically(callback_or_method_name = nil, every:, &block)
  callback =
    if block_given?
      raise ArgumentError, "Pass a block or provide a callback arg, not both" if callback_or_method_name
      block
    else
      case callback_or_method_name
      when Proc
        callback_or_method_name
      when Symbol
        -> { __send__ callback_or_method_name }
      else
        raise ArgumentError, "Expected a Symbol method name or a Proc, got #{callback_or_method_name.inspect}"
      end
    end
  unless every.kind_of?(Numeric) && every > 0
    raise ArgumentError, "Expected every: to be a positive number of seconds, got #{every.inspect}"
  end
  self.periodic_timers += [[ callback, every: every ]]
end