My client and server are communicating consecutively but I want a method that notify when client disconnect from server in handle_in function. As handle_in function is providing response back and everything.
Here’s my handle_in fucntion in room_channel:
def handle_in("message:add", %{"message" => body}, socket) do
room_id = socket.assigns[:room_id]
broadcast!(socket, "room:#{room_id}:new_message", %{body: body})
IO.puts("Received Message from Client: #{body}")
{:reply, {:ok, %{from: "server", body: body}}, socket}
end
This is how I’m getting response back in client from server: