Skip to main content

Module networking

Module networking 

Source
Expand description

Networking module: HTTP client, WebSocket client, connection management.

Provides async-compatible networking primitives for leaderboards, replay sharing, analytics, and live updates. Designed to work with Rust’s standard library plus minimal dependencies — uses non-blocking TCP sockets under the hood with a simple state-machine event loop.

§Modules

  • http — HTTP/HTTPS request/response with retry, caching, rate limiting
  • websocket — WebSocket client with auto-reconnect and message queueing
  • leaderboard — Leaderboard protocol: submit, fetch, paginate
  • analytics — Opt-in telemetry: session, deaths, performance

§Design

All network operations are non-blocking. tick(dt) drives the state machines each frame. Results are delivered through Event queues that the game polls each frame — no async runtime required.

Re-exports§

pub use http::HttpClient;
pub use http::HttpRequest;
pub use http::HttpResponse;
pub use http::HttpEvent;
pub use http::Method;
pub use websocket::WsClient;
pub use websocket::WsMessage;
pub use websocket::WsEvent;
pub use websocket::WsState;
pub use leaderboard::LeaderboardClient;
pub use leaderboard::ScoreEntry;
pub use leaderboard::LeaderboardEvent;
pub use analytics::Analytics;
pub use analytics::AnalyticsEvent;
pub use analytics::SessionStats;

Modules§

analytics
Opt-in analytics and telemetry.
http
HTTP client with retry, caching, and rate limiting.
leaderboard
Leaderboard protocol: submit scores, fetch boards, paginate results.
lobby
Multiplayer lobby system: lobby management, browser, matchmaking, team assignment, ready-checks, and voice-chat metadata.
protocol
Multiplayer networking protocol: packet encoding, decoding, auth tokens, bandwidth tracking, and packet filtering.
rpc
Remote Procedure Call (RPC) system for game events.
sync
Game-state synchronisation: snapshots, delta encoding, client-side prediction, lag compensation, and network clock synchronisation.
transport
Reliable UDP transport layer.
websocket
WebSocket client with auto-reconnect, message queueing, and channel mux.