push_ex v0.0.1-rc3 PushExWeb.PushChannel

Link to this section Summary

Functions

Handle regular Elixir process messages

Intercepts outgoing events

Handle channel joins by topic

Link to this section Functions

Link to this function broadcast(arg, item, opts \\ [])
Link to this function handle_info(atom, socket)

Handle regular Elixir process messages.

See GenServer.handle_info/2.

Callback implementation for Phoenix.Channel.handle_info/2.

Link to this function handle_out(binary, item, socket)

Intercepts outgoing events.

See intercept/1.

Callback implementation for Phoenix.Channel.handle_out/3.

Link to this function join(channel, params, socket)

Handle channel joins by topic.

To authorize a socket, return {:ok, socket} or {:ok, reply, socket}. To refuse authorization, return {:error, reason}.

Example

def join("room:lobby", payload, socket) do
  if authorized?(payload) do
    {:ok, socket}
  else
    {:error, %{reason: "unauthorized"}}
  end
end

Callback implementation for Phoenix.Channel.join/3.