Pleroma v1.1.9-10-g42f76306+dev Pleroma.Web.ChatChannel View Source

Link to this section Summary

Functions

Handle incoming events.

Handle regular Elixir process messages.

Handle channel joins by topic.

Link to this section Functions

Link to this function

handle_in(binary, map, socket)

View Source

Handle incoming events.

Example

def handle_in("ping", payload, socket) do
  {:reply, {:ok, payload}, socket}
end

Callback implementation for Phoenix.Channel.handle_in/3.

Link to this function

handle_info(atom, socket)

View Source

Handle regular Elixir process messages.

See GenServer.handle_info/2.

Callback implementation for Phoenix.Channel.handle_info/2.

Link to this function

join(binary, message, socket)

View Source

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.