Repository navigation
Replies: 1 comment
|
Hey, we changed a few things related to PubSub and defmodule DemoWeb.UserLive do
use Backpex.LiveResource,
adapter_config: [
schema: Demo.User,
repo: Demo.Repo,
update_changeset: &Demo.User.changeset/3,
create_changeset: &Demo.User.changeset/3,
],
layout: {DemoWeb.Layouts, :admin},
on_mount: __MODULE__,
pubsub: [
server: Demo.PubSub,
topic: "users"
]
def on_mount(:default, _params, _session, socket) do
socket = Phoenix.LiveView.attach_hook(socket, :handle_info, :handle_info, &handle_info/2)
{:cont, socket}
end
def handle_info(event, socket) do
dbg(event)
{:halt, socket}
end
...
end |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello guys,
Can you help me, I try to make pubSub working but I am newbie, when I create user, I never receive "user_created".
Where I need to put the handle_info please?
Thank you
All reactions