class Notification::Job
  include Sidekiq::Worker

  def perform(id, new=true)
    user = User.find(id)
    return unless user.online?

    ActionCable.server.broadcast(
      "notifications_channel_#{user.id}",
      refresh_notifications: true,
      new: new
    )
  end
end
