Vehicle and asset GPS tracking with geofencing and location history.
Overview
Track vehicles, delivery drivers, drones, or any moving asset in real time. @nolag/track broadcasts location updates to all zone subscribers instantly. Geofence detection runs client-side using the haversine formula for circular boundaries and a ray-casting algorithm for polygon boundaries, so triggers fire without a server round-trip. Zones group assets by geographic area or fleet. Join multiple zones to observe overlapping regions.
Key Features
Real-time GPS location broadcast to all zone subscribers
In-memory location buffer per asset for client-side history
Client-side geofence detection for circle (haversine) and polygon (ray-casting)
Asset online/offline presence via lobby
Optional metadata attached to each location point
Automatic reconnect with zone and presence restoration
How It Works
NoLagTrack wraps the @nolag/js-sdk client and manages a lobby that tracks which assets are online. Calling joinZone(name) returns a TrackingZone that subscribes to two topics: locations for ephemeral GPS points and _geofence for ephemeral geofence configuration events. Both topics are ephemeral (no server-side retention) to handle high-frequency GPS data without storage overhead. Location history is maintained in-memory on the client. Geofence evaluation happens locally on receipt of each locationUpdate event. No additional server calls are made.