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 utilizes the scs-sdk-telemetry crate to read data from the SCS Telemetry SDK's shared memory space.
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: A dedicated
telemetry-heartbeatevent fires every 5 seconds to confirm 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.