Exchanging events

With the channel connection established, we can now focus on sending and receiving events on the channel. The last step for both the upload and download pipelines is the notifier, which is responsible for letting the user know that their upload/download has finished. Now, we need to modify this step to call the ElixirDripWeb umbrella application, so that we emit the event that notifies the user that their operation is done. Here's the updated code for the notifier step:

$ cat apps/elixir_drip/lib/elixir_drip/storage/pipeline/notifier.ex defmodule ElixirDrip.Storage.Pipeline.Notifier do  # ...   defp notify_step(%{media: %{id: id}, user_id: user_id, type: :download}) do ElixirDripWeb.Notifications.notify(:download, id, user_id) ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.