Hi all,
I’m having a problem which I cannot manage to solve on my own with phoenix channels. Specifically about channels with dynamic topics.
Given that I have the following channel setup:
channel "organization:*", TestWeb.OrganizationChannel
I want to connect on different channels based on dynamic ids passed as topics from the client. Based on a solution I found on an older post I did the following bit:
@impl true
def join(
"organization:" <> organization_id,
params,
socket
) do
# some logic here
Logger.debug("ORG ID -> ", organization_id)
send(self(), :after_join)
{:ok, socket}
end
Everytime I connect to this channel with a topic string that looks like organization:4f1665fa-05d2-450a-bfbd-d105ebb00ede
I receive the following error:
** (Protocol.UndefinedError) protocol Enumerable not implemented for "4f1665fa-05d2-450a-bfbd-d105ebb00ede" of type BitString
If I just run in iex
“organization:” <> id = “organization:123”, the pattern matches ok. What am I missing here? Is there something special with the join
handler?
Thanks in advance and I’m happy to join your community.