Update content of files

This commit is contained in:
GitHub Action 2023-12-24 17:12:28 +00:00
parent 5901d0e238
commit 084d2145f0

View file

@ -119,7 +119,7 @@ Since <code>local_pts + pts_count === pts</code>, the total number of events sin
Since <code>local_pts + pts_count &gt; pts</code> (<code>133 &gt; 132</code>), the update is skipped because we've already handled this update (in fact, our current <code>local_pts</code> was set by this same update, and it was resent twice due to network issues or other issues).</p>
<p>Now let's assume an <a href="/constructor/updateDeleteChannelMessages">updateDeleteChannelMessages</a> from channel <code>123456789</code> is received with <code>pts = 140</code> and <code>pts_count=5</code>.
Since <code>local_pts + pts_count &lt; pts</code> (<code>137 &lt; 140</code>), this means that updates were missed, and the gap must be recovered.</p>
<h5><a class="anchor" href="#secret-chats--bots" id="secret-chats--bots" name="secret-chats--bots"><i class="anchor-icon"></i></a>Secret chats &amp; bots</h5>
<h5><a class="anchor" href="#secret-chats-amp-bots" id="secret-chats-amp-bots" name="secret-chats-amp-bots"><i class="anchor-icon"></i></a>Secret chats &amp; bots</h5>
<p>The whole process is very similar for secret chats and certain bot updates, but there is a <code>qts</code> instead of <code>pts</code>, and events are never grouped, so it's assumed that <code>qts_count</code> is always equal to 1.</p>
<h4><a class="anchor" href="#seq-checking-and-applying" id="seq-checking-and-applying" name="seq-checking-and-applying"><i class="anchor-icon"></i></a><code>seq</code>: checking and applying</h4>
<p>On the top level when handling received <a href="/constructor/updates">updates</a> and <a href="/constructor/updatesCombined">updatesCombined</a> there are four possible cases:</p>
@ -150,6 +150,10 @@ The intermediate status, represented by the <strong>pts</strong>, must be saved
<p>For performance reasons and for better user experience, client can set maximum gap size to be filled: <code>pts_total_limit</code> parameter of <a href="/method/updates.getDifference">updates.getDifference</a> and <code>limit</code> parameter for <a href="/method/updates.getChannelDifference">updates.getChannelDifference</a> can be used.</p>
<p>If the gap is too large and there are too many updates to fetch, a <code>*TooLong</code> constructor will be returned. In this case, the client must <a href="#fetching-state">re-fetch the state</a>, re-start fetching updates from that state and follow the instructions that can be found <a href="/constructor/updates.channelDifferenceTooLong">here</a>.</p>
<p>It is recommended to use limit <code>10-100</code> for channels and <code>1000-10000</code> otherwise.</p>
<h3><a class="anchor" href="#subscribing-to-updates-of-channels-supergroups-we-havent-joined" id="subscribing-to-updates-of-channels-supergroups-we-havent-joined" name="subscribing-to-updates-of-channels-supergroups-we-havent-joined"><i class="anchor-icon"></i></a>Subscribing to updates of channels/supergroups we haven't joined</h3>
<p>Clients may ask the API to passively send them updates for <a href="/api/channel">channels/supergroups</a> they haven't joined, by simply making a <a href="/method/updates.getChannelDifference">updates.getChannelDifference</a> query. </p>
<p>If the specified channel or supergroup is public, or is private but temporarily available for a limited time thanks to a <a href="/constructor/chatInvitePeek">chatInvitePeek</a>, the API will start passively sending updates (i.e. as standalone <a href="/type/Updates">Updates</a> constructors in the socket, as is already the case for normal channels/supergroups we've already joined), as long as the client continues to periodically invoke <a href="/method/updates.getChannelDifference">updates.getChannelDifference</a> every <code>timeout</code> seconds (returned by the method, or every 10 seconds if the <code>timeout</code> flag is absent from the return value of the method). </p>
<p>To stop passively receiving updates, simply stop invoking <a href="/method/updates.getChannelDifference">updates.getChannelDifference</a>, and the API will automatically stop passively sending updates after a while.</p>
<h3><a class="anchor" href="#example-implementations" id="example-implementations" name="example-implementations"><i class="anchor-icon"></i></a>Example implementations</h3>
<p>Implementations also have to take care to postpone updates received via the socket while filling gaps in the event and Update sequences, as well as avoid filling gaps in the same sequence.</p>
<p>Example implementations: <a href="https://github.com/tdlib/td">tdlib</a>, <a href="https://github.com/danog/MadelineProto">MadelineProto</a>. </p>