slender_channel v0.2.0 SlenderChannel
Exposes helpful macros for working with Phoenix Channels
Summary
Functions
Defines a handle_in/3
callback that pattern matches
the given event and payload, broadcasting them in turn to all connected clients
Defines a handle_in/3
callback that pattern matches
the given event and payload, broadcasting them to all other clients
Functions
Defines a handle_in/3
callback that pattern matches
the given event and payload, broadcasting them in turn to all connected clients:
handle_in_and_broadcast "bobby_dumped_stacy", %{"pettiness" => 10}
Becomes:
def handle_in("bobby_dumped_stacy", %{"pettiness" => 10}, socket) do
Phoenix.Channel.broadcast! socket, "bobby_dumped_stacy", %{"pettiness" => 10}
{:noreply, socket}
end
Defines a handle_in/3
callback that pattern matches
the given event and payload, broadcasting them to all other clients:
handle_in_and_broadcast_from "urgent message", %{"ETA" => "10 minutes"}
Becomes:
def handle_in("urgent message", %{"ETA" => "10 minutes"}, socket) do
Phoenix.Channel.broadcast_from! socket, "urgent message", %{"ETA" => "10 minutes"}
{:noreply, socket}
end