Desktop Client (Tauri)
The architecture of the Waylog desktop application.
The Waylog desktop client is the critical bridge between Euro Truck Simulator 2 / American Truck Simulator and the cloud. Built on Tauri v2, it combines a lightweight Rust backend with a modern React frontend.
The Rust Backend
The core responsibility of the Rust layer (src-tauri) is to interface with the game's memory. It reads the Local\WaylogTelemetry shared memory published by waylog-telemetry.dll (the in-repo Rust reimplementation of the SCS telemetry plugin) directly through the local telemetry_reader module — no third-party reader crate, and the client only ever opens the mapping, never creates it.
Polling & Event Emission
- High-Frequency Polling: The Rust service polls the shared memory approximately every 100ms.
- Delta Filtering: To optimize inter-process communication (IPC), the backend only emits
telemetry-updateevents to the frontend when significant values (speed, RPM, location, job state) change. - Heartbeat: The emit gate re-emits
telemetry-updateevery 5 seconds even without significant changes, confirming that the game connection remains active.
The React Frontend
The frontend is responsible for visualizing the data and managing the synchronization state with the server.
TypeScript State Machine
The raw telemetry stream is continuous and noisy. The frontend implements a strict state machine to derive business logic:
- Detects transitions from
NO_JOBtoON_JOB. - Identifies job completion (
DELIVERED) or failures (CANCELLED/ABANDONED). - Monitors sudden spikes in telemetry values to log discrete events, such as traffic fines or toll gate passes.
Offline-First Architecture
Network reliability cannot be guaranteed while driving. The client employs an Outbox Pattern:
- All job updates, GPS route breadcrumbs, and events are immediately written to a local IndexedDB.
- A background synchronization worker continuously attempts to flush this outbox to the server.
- Job payloads utilize deterministic composite keys to ensure that retries result in safe, idempotent upserts rather than duplicated data.