json_rpc_toolkit v0.9.5 JSONRPC.Channel
Link to this section Summary
Link to this section Functions
Link to this function
handle_in(binary, message, socket)
Handle incoming event
s.
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
join(binary, message, 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
.
Link to this function