Phoenix.Channel.intercept/1

Parsed documentation:
View on GitHub
Defines which Channel events to intercept for `handle_out/3` callbacks.

By default, broadcasted events are pushed directly to the client, but
intercepting events gives your channel a chance to customize the event
for the client to append extra information or filter the message from being
delivered.

*Note*: intercepting events can introduce significantly more overhead if a
large number of subscribers must customize a message since the broadcast will
be encoded N times instead of a single shared encoding across all subscribers.

## Examples

    intercept ["new_msg"]

    def handle_out("new_msg", payload, socket) do
      push socket, "new_msg", Map.merge(payload,
        is_editable: User.can_edit_message?(socket.assigns[:user], payload)
      )
      {:noreply, socket}
    end

`handle_out/3` callbacks must return one of:

    {:noreply, Socket.t} |
    {:stop, reason :: term, Socket.t}
Suggestions:
Please help! Open an issue on GitHub if this assessment is incorrect.