coen.bakker
Is it possible to catch broadcasted messages directly in a live component (i.e., without having the root live view catch it first)?
I have a live view that contains a live component. I want the live component to respond to certain broadcasted messages (broadcasted from elsewhere). Do I have to use the root live view to catch the broadcasted messages and pass them on to the live component? Or is it possible to catch the broadcasted messages in the live component directly?
Currently my root live view uses handle_info to catch the broadcasted messages and sends an update to the live component with send_update.
Most Liked
JohnnyCurran
is it possible to catch the broadcasted messages in the live component directly
Unfortunately, it is not, because LiveComponents are not actual processes and so they lack the ability to receive messages from other processes.
Your options are to either continue with send_update* or you can consider using an abstraction such as live_event
kokolegorille
You could use a nested liveview… with the responsability of doing what You don’t want to do in the root liveview.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










