Skip to content

WatchShipment

ShipmentService · Server streaming

Watch carrier events as they arrive. The stream ends when the shipment is delivered.

rpc WatchShipment(WatchShipmentRequest) returns (stream ShipmentEvent);
POST http://localhost:8080/shipping.v1.ShipmentService/WatchShipment

Content types: application/connect+json or application/connect+proto. Messages use Connect stream envelopes. End-of-stream errors and metadata are carried in the final envelope.

The schema declares no idempotency guarantee.

See protocol behavior for metadata, deadlines, errors, cancellation, and streaming.

{
"shipmentId": "shp_123"
}
import { fromJson, toJson } from '@bufbuild/protobuf';
import { createClient } from '@connectrpc/connect';
import { createConnectTransport } from '@connectrpc/connect-node';
import { ShipmentService } from "./gen/shipping/v1/shipping_pb.js";
import { WatchShipmentRequestSchema as InputSchema } from "./gen/shipping/v1/shipping_pb.js";
import { ShipmentEventSchema as OutputSchema } from "./gen/shipping/v1/shipping_pb.js";
const client = createClient(ShipmentService, createConnectTransport({
baseUrl: "http://localhost:8080",
httpVersion: '1.1',
}));
const request = fromJson(InputSchema, {
"shipmentId": "shp_123"
});
for await (const event of client.watchShipment(request)) {
console.log(toJson(OutputSchema, event));
}

These are individual decoded messages. The SDK handles framing and end-of-stream metadata.

{
"shipmentId": "shp_123",
"sequence": "1",
"status": "SHIPMENT_STATUS_IN_TRANSIT",
"occurredAt": "2026-10-31T12:00:00Z"
}
{
"shipmentId": "shp_123",
"sequence": "2",
"status": "SHIPMENT_STATUS_DELIVERED",
"occurredAt": "2026-10-31T12:01:00Z"
}

Source: fixture-v1 · Generator: Wirelit 0.1.0