Closed SlowburnAZ closed 4 years ago
In case it's relevant, I'm running this all in WSL (Ubuntu) on Windows 10
Hey @SlowburnAZ, no worries, this is the perfect place to ask - and thanks for bringing this to my attention.
Do you have LittlechatWeb.Presence
in your supervision tree in application.ex
under the PubSub line? Looking at the article again, it looks like I missed mentioning that. You can use this file for reference: https://github.com/littlelines/littlechat/blob/master/lib/littlechat/application.ex.
Thanks, @JesseHerrick ... that mostly worked. I also had to update the assign in the handle_info function from
def handle_info(%Broadcast{event: "presence_diff"}, socket) do
{:noreply,
socket
|> assign(:connected_users, Presence.list("room:" <> socket.assigns.slug))}
end
to
def handle_info(%Broadcast{event: "presence_diff"}, socket) do
{:noreply,
socket
|> assign(:connected_users, list_present(socket)}
end
@SlowburnAZ glad you got it working! Sometimes keeping track of the changes made to the code in the article and the codebase can be tricky when writing up something like this.
It looks like I missed updating that codeblock from an older version of the codebase as I was working out the details 😄. Let me know if you run into anything else!
Notes for futurs people who will read this : I had the same issue as mention here, I just had to abort + relaunch the server and it worked ! :D
Sorry if this isn't the place to ask this, but while following along with your blog post, after adding the tracking of a user, I'm getting the following error:
The specific line is
{:ok, _} = Presence.track(self(), "room:" <> slug, user.uuid, %{})
It seems the code is correct, but I can't find anything about what might cause this.