Developer docs
1. Transports
On this page
Both transports expose exactly the same methods and messages. Pick one.
1.1 WebSocket (recommended for interactive clients)
- URL:
wss://<host>/v1/ws, WebSocket subprotocoltelevo.v1. - Each binary WS message carries exactly one serialized
televo.v1.Frame. Text messages are a protocol error. Max frame size: 4 MiB. - The first frame from the client MUST be
Frame.hello(ClientHello). The server repliesFrame.welcome(ServerHello) before anything else. - Calls: send
Frame.request {id, method, body}; the server answers withFrame.response {id, body | error}.idis chosen by the client, unique per connection; responses may arrive out of order. Requests may be pipelined. methodis the full gRPC method name without the leading slash, e.g.televo.v1.MessagesService/SendMessage.bodyis the serialized request message; the responsebodyis the serialized response message type from the.proto.- Pushes: once authenticated (valid token in hello, or after a successful
SignIn/SignUp/CheckPassword/ImportBotAuthorizationon this socket), the server pushesFrame.updateat any time, unlessClientHello.no_updatesis set. - Bulk transfers: a WebSocket is one TCP stream, so a large
UploadPart/GetFileframe delays every other frame behind it (messages, updates, evenpong). Clients SHOULD moveFilesServicecalls to a separate WebSocket opened withClientHello.no_updates = true(lazily, closed when idle). On QUIC/WebTransport each RPC has its own stream, so this is unnecessary there. - Keepalive: send
Frame.pingevery ~25 s; the server closes connections idle for more than 75 s. The server may also ping you; answer withpongand the same nonce.
1.2 HTTP (Connect / gRPC / gRPC-Web)
POST https://<host>/televo.v1.<Service>/<Method>- Connect protocol:
Content-Type: application/proto(binary) orapplication/json(canonical protobuf JSON — lowerCamelCase field names, int64 as strings). - Auth header:
Authorization: Bearer <token>. - Live updates: server-streaming
televo.v1.UpdatesService/Stream. - Example:
curl -s https://host/televo.v1.AuthService/SendCode \ -H 'Content-Type: application/json' -d '{"identifier":"+99900001"}'
1.3 QUIC (native apps: preferred; browsers: WebTransport)
Same methods and messages as 1.1, carried over QUIC (RFC 9000) on UDP 443, TLS 1.3
inside QUIC, ALPN televo/1. Purpose: connection migration across network changes,
no head-of-line blocking between calls, 0-RTT reconnects.
Streams
- Control stream = the first client-initiated bidirectional stream. It carries
length-prefixed
Frames (varint length+ bytes, max 4 MiB):hello→welcome,ping/pong, and RPCs that must stay ordered (none today). - One bidirectional stream per RPC: the client opens a stream, writes ONE
length-prefixed
Frame.request, half-closes; the server writes ONEFrame.responseand closes. Requests on different streams are independent (no HOL blocking).RpcRequest.idis still required (logging/tracing), but matching is by stream. - Updates: the server opens ONE unidirectional stream after
welcomeand writes length-prefixedFrame.updates in order. If it is reset, the client re-syncs with GetDifference (exactly like a WebSocket reconnect). - Datagrams (optional, RFC 9221): ephemeral updates (
typing,presence) MAY be sent as QUIC DATAGRAM frames containing one serializedFrame; clients MUST also accept them on the update stream. Never used for logged events. - Upload/download parts (
FilesService/UploadPart,GetFile) SHOULD use their own streams in parallel (4–8 concurrent).
0-RTT: servers accept early data ONLY for the hello on the control stream and for
read-only methods (Get*, Search, CheckUsername, ResolveUsername); any other
method arriving in 0-RTT is rejected with 425 TOO_EARLY and the client retries after the
handshake. (SendMessage is idempotent by random_id anyway, but other methods aren’t.)
Early-data allowlist (exact): hello, and methods whose name starts with Get or
Search, plus CheckUsername and ResolveUsername — except GetPrivateChat
(get-or-create), GetViews (increments counters) and GetCallbackAnswer (notifies a bot),
which have side effects and get 425 TOO_EARLY too.
Error codes: QUIC application close codes (also WebTransport session codes):
0x0 normal, 0x1 protocol error (bad/unexpected frame, frame > 4 MiB on the control
stream), 0x2 no hello within 10 s, 0x3 session revoked, 0x4 server shutdown, 0x5
no control frame and no new RPC stream for 75 s, 0x6 server error. Stream reset / STOP_SENDING codes: 0x1
not exactly one Frame.request, 0x2 frame > 4 MiB, 0x3 request not received within
30 s, 0x10 update stream reset: re-sync with GetDifference (the server opens a new update
stream right away), 0x11 client-opened unidirectional stream (not allowed). Updates are
pushed only on the update stream; welcome is always written before it is opened.
Connection migration: clients keep the connection across Wi-Fi ⇄ cellular changes and
send a ping immediately after a path change; the server never re-authenticates a
migrated connection. Deployments behind load balancers MUST route by QUIC connection ID
(e.g. QUIC-LB server-ID encoding) so a migrated connection reaches the same node.
Racing and fallback (clients MUST): start QUIC and WebSocket in parallel (“happy
eyeballs”), giving QUIC a 300 ms head start; use whichever completes welcome first and
close the other. Remember per network (SSID / cellular carrier) when UDP was blocked and
skip QUIC there for 24 h. Never surface a QUIC failure to the user.
Browsers: WebTransport over HTTP/3 at https://<host>/v1/wt with the identical stream
mapping (control = first bidi stream, per-RPC bidi streams, server uni stream for updates,
datagrams). Browsers without WebTransport use WebSocket.
Idle/keepalive: QUIC idle timeout 60 s; clients ping every 25 s on the control stream (keep-alive also keeps NAT bindings open).
Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.