Developer docs

4. Updates and synchronisation

On this page

Telvoro keeps two kinds of ordered logs:

LogScopeCounterContains
chat logone per chat, shared by membersptsnew/edited/deleted messages, chat info changes, member changes, pins, reactions, polls
user logone per userseqdialog added/removed, read receipts, dialog settings, profile/contacts/blocks

Counters start at 1 and increase by exactly 1 per event.

4.1 Applying pushed updates

on ChatEvent e:
    local = pts[e.chat_id]            # unknown chat -> fetch it, then set pts = e.pts - 1
    if e.pts <= local:       ignore (duplicate)
    elif e.pts == local + 1: apply; pts[e.chat_id] = e.pts
    else:                    buffer e; after ~0.5 s if gap still open ->
                             GetChatDifference(chat_id, local)
on UserEvent e:              same with the single counter `seq` and GetDifference

Ephemeral updates (typing, presence, views, callback_query, inline_query) are not logged and have no counters; just apply them.

4.2 Catching up after being offline

  1. GetDifference(seq, date) → missed user events (apply in order), plus changed_chats: every chat of yours with activity after date and its current pts. Repeat while more. If too_long, reload the dialog list via GetDialogs.
  2. For each changed chat you have cached (lazily: when the chat is opened, for big channels), GetChatDifference(chat_id, local_pts); repeat while more. If too_long, discard the chat’s local history and reload it with GetHistory.
  3. First login: GetState → store seq/date, then GetDialogs; each Chat.pts in the result is the starting pts for that chat.

Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.