I created a counter because I need atomic updates. I’m looking for the best way to share the value of that counter will all relevant clients. I’ve read a lot of docs and scanned the source code, but nothing jumps out to me as a great way to do this. I see how I can dispatch a custom event, but I don’t see how I can subscribe to them from another client. It doesn’t appear I can subscribe to the counter directly either. The next thing I’ll try it using channels, which will probably work, but seems like overkill when all I want is to be aware of updates to a counter value.
Hi Chris,
Welcome to our community!
One possibility I am thinking of is creating an API service that would essentially become a proxy for the Counters API. The service would enrich the functionality by broadcasting a message to some well-known channel(s) in your app when the counter value changes. The clients then would use real-time messaging to subscribe to the channel(s).
Regards,
Mark