Hi guys,
I am facing an issue. Please help me out.
I have two different channel for different user type like Admin and User.
Channel admin:{admin_id} for admin
Channel user:{user_id} for users
Every admin and users will connect with their own topic, I am tracking their presence but the problem is when user or admin connecting channels that overriding their presence.
user_channel.ex
{:ok, _} =
Presence.track(socket, “user:#{socket.assigns.id}”, %{
user_type: socket.assigns.sender,
user_id: socket.assigns.userid
})
Admin
admin_channel.ex
{:ok, _} =
Presence.track(socket, “agent:#{socket.assigns.id}”, %{
user_type: socket.assigns.sender,
user_id: socket.assigns.userid
})
Presence
presence.ex
use Phoenix.Presence,
otp_app: :myapp,
pubsub_server: MyappWeb.PubSub,
pool_size: 10
def fetch(_topic, entries) do
IO.inspect(_topic)
IO.inspect(entries)
end