class TaskChannel < ApplicationCable::Channel

  def subscribed
    stream_for current_user.id
  end

  def self.update_task_list(task_list)
    task_list.reload
    self.broadcast_to task_list.user_id, { task_list: TaskListSerializer.for(task_list), action: 'updated' }
  end

end
