We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Creating a Distributed Timer Using Phoenix LiveView
88
clicks
Source: chrisodonnell.dev
This article explains the implementation of a distributed timer in a Phoenix LiveView app, where one user can start a timer visible to others in their group. The timer features functionalities such as pausing, restarting, and stopping. It emphasizes state management and communication strategies using client-side hooks, server events, and Phoenix Pubsub to ensure all users see a consistent timer state. The database retains timer states, accommodating scenarios where users might disconnect. Moreover, client-side logic ensures a smooth user experience without depending on the accuracy of users' clocks. The article also highlights testing strategies for the timer functionality to confirm communication and updates work correctly among users.
Related posts
© HashMerge 2025