<metaproperty="description"content="The provided pts + limit < remote pts. Simply, there are too many updates to be fetched (more than limit), the client has to resolve the update gap in one of the following ways (assuming the existence of a persistent database to locally store messages): 1. Delete all known messages in the chat, begin from scratch by refetching all messages manually with messages.getHistory. It is easy to implement, but suddenly disappearing messages look awful to the user. 2. Save all messages loaded in the memory until application restart, but delete all messages from the database. Messages left in the memory must be lazily updated using calls to messages.getHistory. It will look much smoother to the user, they will need to redownload messages only after client restart. Unsynchronized messages left in memory shouldn't be saved to the database, results of messages.getHistory and messages.getMessages must be used to update the state of deleted and edited messages left in the memory. 3. Save all messages loaded in the memory and stored in the database without saving that some messages form continuous ranges. Messages in the database will be excluded when paginating through or searching the local message history after application restart and will be available only through individual message queries. Every message should still be checked using messages.getHistory. It has more disadvantages over 2) than advantages. 4. Save all messages with saving all data about continuous message ranges. Messages from the database may be used when paginating through or searching the local message history. The messages should still be lazily checked using messages.getHistory, but they are still available offline. It is the best way for gaps support, but it is pretty hard to implement correctly. It should be also noted that some messages like live location messages shouldn't be deleted.">
<metaproperty="og:description"content="The provided pts + limit < remote pts. Simply, there are too many updates to be fetched (more than limit), the client has to resolve the update gap in one of the following ways (assuming the existence of a persistent database to locally store messages): 1. Delete all known messages in the chat, begin from scratch by refetching all messages manually with messages.getHistory. It is easy to implement, but suddenly disappearing messages look awful to the user. 2. Save all messages loaded in the memory until application restart, but delete all messages from the database. Messages left in the memory must be lazily updated using calls to messages.getHistory. It will look much smoother to the user, they will need to redownload messages only after client restart. Unsynchronized messages left in memory shouldn't be saved to the database, results of messages.getHistory and messages.getMessages must be used to update the state of deleted and edited messages left in the memory. 3. Save all messages loaded in the memory and stored in the database without saving that some messages form continuous ranges. Messages in the database will be excluded when paginating through or searching the local message history after application restart and will be available only through individual message queries. Every message should still be checked using messages.getHistory. It has more disadvantages over 2) than advantages. 4. Save all messages with saving all data about continuous message ranges. Messages from the database may be used when paginating through or searching the local message history. The messages should still be lazily checked using messages.getHistory, but they are still available offline. It is the best way for gaps support, but it is pretty hard to implement correctly. It should be also noted that some messages like live location messages shouldn't be deleted.">
<divid="dev_page_content"><p>The provided <code>pts + limit < remote pts</code>. Simply, there are too many updates to be fetched (more than <code>limit</code>), the client has to resolve the update gap in one of the following ways (assuming the existence of a persistent database to locally store messages):</p>
<ol>
<li>Delete all known messages in the chat, begin from scratch by refetching all messages manually with <ahref="/method/messages.getHistory">messages.getHistory</a>. It is easy to implement, but suddenly disappearing messages look awful to the user.</li>
<li>Save all messages loaded in the memory until application restart, but delete all messages from the database. Messages left in the memory must be lazily updated using calls to <ahref="/method/messages.getHistory">messages.getHistory</a>.<br>
It will look much smoother to the user, they will need to redownload messages only after client restart.<br>
Unsynchronized messages left in memory shouldn't be saved to the database, results of <ahref="/method/messages.getHistory">messages.getHistory</a> and <ahref="/method/messages.getMessages">messages.getMessages</a> must be used to update the state of deleted and edited messages left in the memory.</li>
<li>Save all messages loaded in the memory and stored in the database without saving that some messages form continuous ranges.<br>
Messages in the database will be excluded when paginating through or searching the local message history after application restart and will be available only through individual message queries.<br>
Every message should still be checked using <ahref="/method/messages.getHistory">messages.getHistory</a>.<br>
It has more disadvantages over 2) than advantages.</li>
<li>Save all messages with saving all data about continuous message ranges.<br>
Messages from the database may be used when paginating through or searching the local message history.<br>
The messages should still be lazily checked using <ahref="/method/messages.getHistory">messages.getHistory</a>, but they are still available offline.<br>
It is the best way for gaps support, but it is pretty hard to implement correctly.</li>
</ol>
<p>It should be also noted that some messages like live location messages shouldn't be deleted.</p>
<p><divclass="clearfix">
<ulclass="dev_layer_select slightly-pull-right nav nav-pills">
<h4><aclass="anchor"href="#working-with-updates"id="working-with-updates"name="working-with-updates"><iclass="anchor-icon"></i></a><ahref="/api/updates">Working with Updates</a></h4>
<p>How to subscribe to updates and handle them properly.</p>