Working with Updates
While a user is working with one of the River clients, It is quite common to happen some events that the user expects to get them as soon as possible, e.g. a new message. An update delivery mechanism is considered by which clients don't require to download these events regularly. This way, The server will send corresponding notifications over one of the users' available connections.
River developers supposed UpdateEnvelope and UpdateContainer methods to manage events depending on a defined timespan.
When a user becomes active through one of its clients, the existing and waiting dialogues will be called as a snapshot from the server. After that, when one of these events listed below occur, for example, a new message was sent, or a profile picture had been changed, and so on, an Update method will be invoked.
Updates will be invoked either individually or as batches. Accordingly, When an event occurs, the server waits for a time and if after this time doesn't receive any new events will call Update Envelope method and flash an event solely. Otherwise, it will stop for more time and then if nothing has changed, UpdateContainer will be called and sent a batch of events together.
Pay attention that this mechanism is to reduce latency time between server and client.
List of Updates
Ultimately, we mentioned below a list of events that be handled by this mechanism and called as Updates.
The list of Updates: