Connect to the Chidori WebSocket server to receive real-time driver location updates for your deliveries. This is ideal for building live tracking maps and interfaces.
Required permission:location:read
WebSocket is only available in the live environment. Sandbox mode does not support real-time location tracking.
You can only subscribe to deliveries that belong to your account. When you subscribe to a delivery, the server verifies that the delivery’s userId matches your API key’s owner. This ensures you only receive location updates for your own deliveries.
Attempting to subscribe to another user’s delivery will result in an error: “Delivery not found or not owned by you”
socket.on('error', (error) => { switch (error.message) { case 'Authentication required': console.error('No API key provided'); break; case 'Invalid API key': console.error('API key is invalid or revoked'); break; case 'WebSocket not available in sandbox mode': console.error('Use a live API key for WebSocket'); break; case 'Missing location:read permission': console.error('API key lacks location:read permission'); break; case 'Delivery not found or not owned by you': console.error('Cannot subscribe to this delivery'); break; default: console.error('WebSocket error:', error.message); }});