Update Shopping Carts in Real-time
Learn how to update shopping carts in real-time.
We'll cover the following...
We'll cover the following...
Updating the cart
We’ll hook into two different functions to update the tracked cart:
- When the Channel broadcasts its cart.
- When it receives a broadcast that the cart contents have changed.
Add the highlighted send/2 function calls in the existing ShoppingCartChannel functions.
Presence works by sending an initial state to a client and keeping that state up to date by pushing changes. We need to send the initial state ourselves in the Admin.DashboardChannel. Add the following ...