Livelocd
Livelocd is a lightweight Axum-compatible plugin for real-time location tracking via WebSockets and a JSON API. Easily drop it into any Rust backend to enable live geolocation dashboards, game user tracking, or delivery fleet monitoring.
β¨ Features
- π‘ WebSocket support for sending real-time location updates
- π Subscribe to all users or individual users' locations
- π REST API to query current locations
- π§© Designed as a plugin for Axum or Loco.rs apps
- β‘ Built with minimal dependencies, powered by
tokio,axum, andserde_json
π¦ Installation
In your projectβs Cargo.toml:
= { = "../livelocd" } # or use Git/crates.io in the future
π Usage
In your Axum project:
use Router;
use livelocd_routes;
async
π‘ WebSocket Endpoints
GET /ws/send-locationβ Send JSON with auser_idand any arbitrary fields (e.g., lat/lng)GET /ws/subscribeβ Receive real-time updates for all usersGET /ws/subscribe/:user_idβ Subscribe to updates for a specific user
Example JSON payload:
π REST API Endpoints
GET /api/usersβ Get current known location for all usersGET /api/users/:user_idβ Get most recent location for a single user
π Privacy & Security
You are responsible for securing the WebSocket and API endpoints (auth, rate limiting, etc.) based on your use case.
π Use Cases
- Live fleet or delivery tracking
- Multiplayer game player positions
- Dashboards for location-aware apps
- IoT geolocation feeds
π§ͺ Testing Locally
Use websocat:
# Send location
}
# Subscribe to all
π Built With
π License
MIT
π€ Contributing
Pull requests welcome! Letβs make real-time dashboards in Rust even easier.