I have implemented a chat feature using ActionCable. I am now trying to implement a presence status based on the implementation of user appearances in the README.
This documentation mention the following statement:
The #subscribed callback is invoked when, as we'll show below, a client-side subscription is initiated. In this case, we take that opportunity to say "the current user has indeed appeared". That appear/disappear API could be backed by Redis or a database or whatever else.
I can implement an online attribute in my database and update it when the application receives appear/disappear notifications. But I have no guarantee about the reliability of this attribute. It could become out of sync in case of a server failure for example.
How could I implement this in a reliable way?