Search code examples
phoenix-frameworkphoenix-channels

Phoenix Presence: How to rename "presence_diff" to something more domain specific?


Phoenix has a nice event for broadcasting presence changes called presence_diff. I've tried to find a way to rename this event to something more specific to my domain (agent_diff in my case).

Does anyone know if there's an idiomatic way of doing this?


Solution

  • This was the solution I came up with, please let me know if you have a better approach

    intercept ["presence_diff"]
    def handle_out("presence_diff", msg, socket) do
      push(socket, "agent_diff", msg)
      {:noreply, socket}
    end