I have a LiveView that subscribes to a Phoenix.PubSub topic and shows some logs in real time. Now I want to move this part into a stateful LiveComponent, so that all logic regarding subscribing and reacting to messages in the topic lies within it.
But, I think this can’t be done - I can subscribe to the topic from within the LiveComponent, but it’s the parent LiveView process who is going to receive the messages, so I still need to have the
handle_info logic in the parent LV process.
Is there something similar to
phx-target="@myself" that can be used for PubSub like it’s done for events, so I can achieve this?