Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule PhoenixChannels.RoomChannel do
- use Phoenix.Channel
- def join("rooms:lobby", auth_msg, socket) do
- {:ok, socket}
- end
- def join("rooms:" <> _private_room_id, _auth_msg, socket) do
- {:error, %{reason: "unauthorized"}}
- end
- def handle_in("new_msg", %{"body" => body}, socket) do
- broadcast! socket, "new_msg", %{body: body}
- {:noreply, socket}
- end
- def handle_out("new_msg", payload, socket) do
- push socket, "new_msg", payload
- {:noreply, socket}
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement