| Crates.io | livelocd |
| lib.rs | livelocd |
| version | 0.1.0 |
| created_at | 2025-06-24 18:05:41.874217+00 |
| updated_at | 2025-06-24 18:05:41.874217+00 |
| description | A simple Axum plugin for real-time location tracking via WebSockets and JSON API. |
| homepage | https://github.com/Burnsedia/livelocd |
| repository | https://github.com/Burnsedia/livelocd |
| max_upload_size | |
| id | 1724843 |
| size | 35,456 |
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.
tokio, axum, and serde_jsonIn your projectβs Cargo.toml:
livelocd = { path = "../livelocd" } # or use Git/crates.io in the future
In your Axum project:
use axum::Router;
use livelocd::livelocd_routes;
#[tokio::main]
async fn main() {
let app = Router::new().merge(livelocd_routes());
axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
.serve(app.into_make_service())
.await
.unwrap();
}
GET /ws/send-location β Send JSON with a user_id and 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{
"user_id": "user123",
"lat": 33.7489954,
"lng": -84.3879824,
"status": "moving"
}
GET /api/users β Get current known location for all usersGET /api/users/:user_id β Get most recent location for a single userYou are responsible for securing the WebSocket and API endpoints (auth, rate limiting, etc.) based on your use case.
Use websocat:
# Send location
websocat ws://localhost:3000/ws/send-location
{"user_id": "car-1", "lat": 40.7, "lng": -74.0}
# Subscribe to all
websocat ws://localhost:3000/ws/subscribe
MIT
Pull requests welcome! Letβs make real-time dashboards in Rust even easier.