We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Responding to Global Broadcasts in Phoenix LiveView Apps
248
clicks
Source: andrewtimberlake.com
Andrew Timberlake explains a method for responding to channel broadcasts in a global manner within a Phoenix LiveView application. He describes the challenge of updating a global state, such as a message counter, across all LiveView instances. The article outlines various approaches and ultimately provides a solution using Elixir's macro tools and the `@before_compile` attribute to ensure global subscription handling without hindering individual LiveView subscriptions. It includes code examples and discusses the implications of different strategies such as using LiveComponents and live sessions.
Related posts
© HashMerge 2024