I am broadcasting a message from a channel handle_in
to another topic
def handle_in(
"set_block_user",
%{"block_active" => true, "blocked_user_id" => bid},
%{assigns: %{user_id: user_id}} = socket
) do
case Accounts.set_block_user(user_id, bid) do
{:ok, _} ->
blocked_user_topic = user_topic(bid)
ChataWeb.Endpoint.broadcast_from(self(), blocked_user_topic, "account_removed", user_id)
{:reply, :ok, socket}
{:error, _} ->
{:reply, :error, socket}
end
end
and getting the following error:
** (UndefinedFunctionError) function ChataWeb.UserChannel.handle_out/3 is undefined or private
(chata 0.1.0) ChataWeb.UserChannel.handle_out("account_removed"
Which causes the channel process to crash.
This is weird to me because I have other similar calls that don’t ask for handle_out
e.g.
ChataWeb.Endpoint.broadcast_from(self(), interlocutor_topic, "new_msg", msg_payload)
Why is it asking for handle_out
in this case specifically?