Tracking API
Real-Time Vehicle & Asset Location Streaming via WebSockets
Overview
The Tracking API enables real-time location streaming between drivers (or mobile agents) and offices (or control centers) using secure WebSocket connections.
This API is designed for fleet tracking, delivery monitoring, dispatch systems, and live map visualization, allowing multiple roles to communicate through a single persistent connection.
With support for authentication, subscriptions, and continuous location updates, the Tracking API ensures low-latency, scalable, and reliable tracking across your organization.
Key Features
-
π Real-time driver location updates
-
π’ Office subscriptions to specific drivers or all drivers
-
π‘ Low-latency WebSocket streaming
Connection Endpoint
Roles
| Role | Description |
|---|---|
driver | Sends live location updates |
office | Subscribes to driver locations |
Use Cases
Fleet Tracking
Monitor all active drivers in real time from a central office dashboard.
- Live vehicle movement on maps
- Instant visibility into fleet status
- Improved operational awareness
Delivery Monitoring
Track individual delivery drivers to ensure accurate ETAs and route compliance.
- Subscribe to specific drivers
- Detect delays or route deviations
- Improve customer satisfaction
Dispatch & Control Centers
Allow offices to observe and manage driver activity efficiently.
- Subscribe to all drivers or selected drivers
- Real-time decision making
- Seamless coordination between teams
Live Map Visualization
Integrate real-time location data into web or mobile maps.
- Smooth marker updates
- Accurate vehicle positioning
- Enhanced user experience
Authentication Flow
All clients must authenticate immediately after connection.
Authenticate Message
Parameters
| Field | Type | Description | Required |
|---|---|---|---|
user_id | string | Unique identifier of the user | yes |
role | string | driver or office | yes |
token | string | Valid JWT access token | yes |
Driver: Sending Location Updates
Once authenticated, a driver can continuously send location updates.
Location Update Message
Payload Fields
| Field | Type | Description |
|---|---|---|
lat | number | Latitude |
lng | number | Longitude |
speed | number | Speed (km/h) |
bearing | number | Direction in degrees |
π Recommended update interval: 2β5 seconds
Office: Subscribing to Drivers
Offices can subscribe to specific drivers or all drivers.
Subscribe to a Specific Driver
Subscribe to All Drivers in the Company
Receiving Location Updates (Office)
Subscribed offices receive real-time updates in the following format:
Heartbeat (Ping / Pong)
The server may send WebSocket ping frames to ensure connection health.
Clients must respond with pong:
Example Implementations
Error Handling
| Error | Description |
|---|---|
Unauthorized | Invalid or missing token |
InvalidAction | Unsupported action type |
Forbidden | Unauthorized subscription |
BadPayload | Missing or malformed fields |
Limits & Restrictions
-
π Max connections: Configurable per company
-
π‘ Location update rate: Max 1 update per second per driver
-
π Token expiration: Connections close automatically on expiry
-
π’ Company isolation: Offices only receive data from their company