Delivery SDK
Build delivery timelines and courier visibility.
Use DomVia Realtime delivery patterns for UPS-style package progress, Uber-style courier movement, same-day dispatch, customer tracking, and operator dashboards.
Package
@domvia/realtime-delivery
install
npm install @domvia/realtime @domvia/realtime-delivery @domvia/realtime-location
@domvia/realtime-delivery
Built for focused realtime use cases.
Keep the SDK modular, documented, and safe to extend as new products are added.
Architecture
How this guide should be used.
Step 01
Use delivery status as the timeline
Delivery status events are the customer-facing story. They should be stable, readable, and easy to display in product screens.
Step 02
Use location as a supporting stream
Live location is useful while the courier is moving, but it should not replace status events like picked up, nearby, delayed, or delivered.
Step 03
Separate customer and operator visibility
Operators may need more detail than customers. Use authorization to control which delivery events each viewer can receive.
Step 04
Store final history on your server
Realtime events are for instant updates. Your app server should still store the delivery record, audit trail, proof, and final status.
Examples
Focused implementation notes.
Customer delivery stream
Subscribe to one protected delivery channel and listen for status, ETA, driver, completion, and location updates.
Customer delivery stream
import { DomViaRealtime } from "@domvia/realtime";
import { createDeliveryStream } from "@domvia/realtime-delivery";
const realtime = DomViaRealtime.create({
key: "pk_live_your_public_key",
host: "ws.domvia.net",
authEndpoint: "/realtime/auth",
});
const delivery = createDeliveryStream(realtime, {
deliveryId: "order-1001",
mode: "delivery",
channelKind: "private",
sessionId: "day-2026-05-26",
});
delivery.onDriverAssigned((event) => {
console.log("Driver assigned:", event.driver_id);
});
delivery.onStatus((event) => {
updateTimeline(event.status, event.message);
});
delivery.onLocation((event) => {
map.moveMarker(event.lat, event.lng);
});
delivery.onCompleted((event) => {
showCompletedState(event.completed_at);
});Server-side delivery events
Use stable event builders before broadcasting from your trusted server.
Server-side delivery events
import {
buildDeliveryEtaEvent,
buildDeliveryStatusEvent,
buildDriverAssignedEvent,
} from "@domvia/realtime-delivery";
const assigned = buildDriverAssignedEvent("order-1001", {
driver_id: "driver-44",
driver_name: "Demo Driver",
vehicle: {
label: "Blue van",
plate_number: "DV-2026",
},
});
const status = buildDeliveryStatusEvent("order-1001", {
status: "in_transit",
message: "Driver is on the way.",
eta_seconds: 420,
});
const eta = buildDeliveryEtaEvent("order-1001", {
eta_seconds: 420,
distance_meters: 1800,
confidence: "high",
});Safety
Rules before production traffic.
✓ Use private channels for delivery-specific customer updates.
✓ Do not expose internal driver notes to customer channels.
✓ Keep raw GPS separate from customer-facing delivery status.
✓ Rate-limit noisy updates so high-volume delivery apps stay stable.
✓ Keep permanent records on your trusted server.
Continue