Developer docs
4. Updates and synchronisation
On this page
Telvoro keeps two kinds of ordered logs:
| Log | Scope | Counter | Contains |
|---|---|---|---|
| chat log | one per chat, shared by members | pts | new/edited/deleted messages, chat info changes, member changes, pins, reactions, polls |
| user log | one per user | seq | dialog 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
GetDifference(seq, date)→ missed user events (apply in order), pluschanged_chats: every chat of yours with activity afterdateand its currentpts. Repeat whilemore. Iftoo_long, reload the dialog list viaGetDialogs.- For each changed chat you have cached (lazily: when the chat is opened, for big
channels),
GetChatDifference(chat_id, local_pts); repeat whilemore. Iftoo_long, discard the chat’s local history and reload it withGetHistory. - First login:
GetState→ storeseq/date, thenGetDialogs; eachChat.ptsin the result is the startingptsfor that chat.
Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.