WatchShipment
ShipmentService · Server streaming
Watch carrier events as they arrive. The stream ends when the shipment is delivered.
RPC contract
Section titled “RPC contract”rpc WatchShipment(WatchShipmentRequest) returns (stream ShipmentEvent);
Connect endpoint
Section titled “Connect endpoint”POST http://localhost:8080/shipping.v1.ShipmentService/WatchShipmentContent 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.
Request example
Section titled “Request example”{ "shipmentId": "shp_123"}Calling this method
Section titled “Calling this method”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));}package main
import ( "context" "fmt" "log" "net/http" "connectrpc.com/connect" "google.golang.org/protobuf/encoding/protojson" pb "github.com/lanej/wirelit/examples/go/gen/shipping/v1" rpc "github.com/lanej/wirelit/examples/go/gen/shipping/v1/shippingv1connect")
func main() { client := rpc.NewShipmentServiceClient(http.DefaultClient, "http://localhost:8080") request := new(pb.WatchShipmentRequest) if err := protojson.Unmarshal([]byte("{\n \"shipmentId\": \"shp_123\"\n}"), request); err != nil { log.Fatal(err) } stream, err := client.WatchShipment(context.Background(), connect.NewRequest(request)) if err != nil { log.Fatal(err) } defer stream.Close() for stream.Receive() { data, err := protojson.Marshal(stream.Msg()) if err != nil { log.Fatal(err) } fmt.Println(string(data)) } if err := stream.Err(); err != nil { log.Fatal(err) }}Streamed messages
Section titled “Streamed messages”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