Over the weekend I have built a little device management frontend in Phoenix with LiveView and live updating the frontend would be amazing!
However, I am not sure how to use PubSub properly for the following views:
- Group list: all devices are part of a device group. This view lists the groups and how many devices in this group are online/offline.
- Group details + device details: Lists all devices of one group (online/offline status and name) with one device being in focus of which more details are listed.
A device going online or offline should change both views and I wonder what a smart way to use PubSub in this case is.
My first thought was:
- subscribe to all groups on the group overview (might be hundreds tho, is that a problem?)
- subscribe to a single group and a single device on the details view (fine I think).
There is probably a smarter approach than subscribing to all groups on the group overview?