Skip to main content

Module constants

Module constants 

Source
Expand description

Constants used throughout the offline-protocol crate.

Constants§

ACK_COALESCE_MAX
How many frames one coalesced delivery ACK may answer. Five keeps a coalesced ACK inside one fragment at the 185-byte floor’s neighbour, the 512-byte fragment both phones negotiate: 264 bytes plus four 37-byte ids.
ACK_COALESCE_WINDOW
The longest a delivery ACK waits to be coalesced with others to the same peer. Short against the 10-second acknowledgement timeout; long enough that at a few messages a second each ACK frame answers two or three.
ACK_FOR_KEY
Metadata key for ACK messages indicating which message ID the ACK is for.
ACK_HOP_COUNT_KEY
Metadata key for ACK messages indicating the hop count.
ACK_MORE_KEY
Metadata key on a delivery ACK that answers more than one frame: the ids after the one in ACK_FOR_KEY, comma-separated. Sent only to a peer that advertised ACK_COALESCED_V1, and never on an undecryptable answer. A peer that ignores it still settles the first id, and the rest through their resends’ duplicate re-acknowledgement.
ACK_STATUS_KEY
Metadata key on an ACK that answers a frame without delivering it. Absent on an ordinary delivery ACK.
ACK_STATUS_UNDECRYPTABLE
ACK_STATUS_KEY value: the recipient can never decrypt the frame it names (a spent ratchet generation, a dead epoch, or the pending-decryption queue gave up on it). The sender resends the message once; it is never message_delivered. Still a delivery ACK in shape, so a relay holding the frame drops it.
ACK_TRANSPORT_KEY
Metadata key for ACK messages indicating the transport used.
CHUNK_SIZE_BLE
Chunk size for BLE file transfers (4 KB). Reduces BLE double-fragmentation: ~22 BLE fragments per chunk instead of ~240.
CHUNK_SIZE_INTERNET
Chunk size for Internet file transfers (256 KB). Fewer round-trips over WebSocket where bandwidth is plentiful.
DEFAULT_CHUNK_SIZE
Default chunk size for file transfers (32 KB).
DEFAULT_INITIAL_TTL
Default time-to-live for messages.
DEFAULT_MEDIA_WINDOW_SIZE
Default maximum chunks in flight for media transfers.
FLUSH_BATCH_LIMIT
Maximum messages to send in a single flush operation. Prevents blocking the process loop when many messages are pending.
HISTORY_CLEANUP_BATCH_SIZE
Number of messages to remove when history exceeds the maximum. This provides a buffer to avoid frequent cleanup operations.
HOP_COUNT_EMA_ALPHA
EMA alpha for hop count tracking.
LATENCY_EMA_ALPHA
EMA (Exponential Moving Average) alpha for latency tracking.
MAX_CONCURRENT_INTERNAL_MEDIA_TRANSFERS_PER_PEER
How many of a peer’s transfer slots the SDK’s own document-layer traffic may occupy at once.
MAX_CONCURRENT_MEDIA_TRANSFERS_PER_PEER
Maximum concurrent outbound media transfers per recipient when chunks are MLS-encrypted.
MAX_FORWARD_COUNT
Maximum number of times a message may be forwarded. Prevents unbounded forwarding chains from malicious or buggy clients.
MAX_MEDIA_DESCRIPTORS
Maximum persisted outbound media transfer descriptors restored after a restart (newest-first). Small on purpose: each maps to a MediaResendRequired the app is expected to act on, and concurrent transfers are already capped per peer.
MAX_MEDIA_OUTBOX_ENTRIES
Maximum entries in the dedicated media outbox. Smaller than the main outbox since the sliding window limits in-flight chunks.
MAX_MESSAGE_HISTORY
Maximum number of messages to keep in history for topology visualization. This prevents unbounded memory growth while maintaining enough history for accurate network statistics.
MAX_OUTBOX_ENTRIES
Maximum number of entries in the outbox before evicting oldest entries. This prevents unbounded memory growth when messages cannot be delivered.
MEDIA_WINDOW_SIZE_BLE
Maximum chunks in flight for BLE media transfers. BLE’s low bandwidth means fewer concurrent chunks to avoid congestion.
MEDIA_WINDOW_SIZE_INTERNET
Maximum chunks in flight for Internet media transfers.
NO_ALERT_KEY
Metadata key marking a frame the SDK sent on its own: control traffic, key packages, data-sync frames, receipts, typing, presence, and a 1:1 Welcome no user message is waiting on.
OBSERVED_STATS_COMPACT_THRESHOLD
Threshold for compacting observed stats to prevent unbounded growth.
ORIGINAL_CONTENT_TYPE_KEY
Metadata key carrying the original content type on file-chunk messages.
OUTBOX_ABSOLUTE_LIFETIME_FACTOR
Absolute cap on a restored outbox entry’s total lifetime, as a multiple of outbox_max_lifetime_ms, measured from first_sent_at.
TRANSPORT_PREFERENCE_INTERNET
Transport preference value: prefer internet transport.
TRANSPORT_PREFERENCE_KEY
Metadata key indicating preferred transport for a message.