1 realtime egress mailboxes and lane scheduling
forgejo-actions edited this page 2026-07-11 10:33:50 +00:00

Realtime Egress Mailboxes And Lane Scheduling

Realtime egress is the outbound quality-of-service layer between server authority and each connected client. It separates reliable stream traffic from datagram traffic, keeps control messages from being blocked by background snapshots, and applies descriptor-owned delivery policy before packets leave the game server.

How It Works

Server code creates authoritative envelopes and hands them to the outbound session path. Reliable traffic is grouped into control, gameplay, and background lanes. Datagram traffic uses reserved and normal lanes so movement or correction traffic can be prioritized over bulk state updates. The session-stream loop schedules lanes, writes packets, and records mailbox or transport pressure.

Delivery descriptors from the realtime wire registry decide which messages may drop, which must remain reliable, and which lane should carry them.

How To Use It

Use the session egress helpers instead of writing directly to a stream or datagram socket. Gameplay authority, AOI replication, chat, combat, and state snapshots should send through descriptor-aware helpers so lane policy and packet validation stay active.

When adding a new packet, define its registry delivery behavior before choosing a lane in runtime code.

Invariants

Control and disconnect-critical traffic must not wait behind background updates. Reserved datagrams must not be starved by normal datagrams. Mailbox-full behavior must match the descriptor: some messages can be dropped and accounted, while others require backpressure or disconnect-safe delivery.

Debugging

Use mailbox, drop, and transport metrics to identify lane pressure. Packet captures help confirm that a packet is encoded on the lane declared by the registry. If reliable gameplay responses arrive late, inspect background mailbox volume and scheduler order. If datagrams disappear, compare runtime profile, QUIC health, and descriptor backpressure policy.

Examples

Chat history and disconnect messages belong on reliable lanes. A large AOI snapshot can use a background reliable lane or normal datagram path depending on profile and descriptor policy. Movement correction should use a reserved path when the profile permits datagrams.