To simulate a user being unauthenticated and disconnected in all liveviews and channels you can do:
MyAppWeb.Endpoint.broadcast("users_socket:#{user.id}", "disconnect", %{})
This covered in the documentation here Disconnecting all instances of a live user.


















