How to emit a message to channel from redis pubsub

Hi guys,

i am currently working on a microservice architectured application, now, i am building our real time layer and i will be using phoenix. My question is how do i make phoenix subscribe to redis pubsub and broadcast the message coming from redis subscription?

 defmodule PhoenixChat.UserSocket do

  use Phoenix.Socket

  ## Channels
  channel("room:*", PhoenixChat.RoomChannel)

  ## Transports
  transport(:websocket, Phoenix.Transports.WebSocket)

  def connect(%{"token" => token}, socket) do

    signer = token
    |> Joken.token
    |> Joken.with_signer(Joken.hs256("shared-secret-key-for-all-services"))

    case signer |> Joken.verify! do
      {:ok, claims} ->
        {:ok, assign(socket, :user, claims)}
      {:error, _} ->
        {:ok, assign(socket, :user_id, nil)}

  def id(_socket), do: nil

If your question is related to Phoenix or Nerves, please post it in the Phoenix or Nerves Questions / Help section. Thanks!