OpenPrinterOpenPrinter

Example Server

Disposable Node.js discovery, pairing, gateway, and job integration.

examples/node-server is a local node:http and ws host for the published package boundaries.

RoutePurpose
GET /.well-known/openprinterDiscovery document
POST /openprinter/pairPairing-code redemption and public-key registration
/.well-known/openprinter/gatewayChallenge-authenticated WebSocket upgrade
POST /development/pairing-codeCreate a disposable local code
POST /agents/:agentId/jobsDeliver a validated job to a live session

The process logs one development pairing code at startup. It uses the SDK's volatile stores, so restarting invalidates every pairing. That behavior is useful for tests but unsuitable for production.

The host owns the WebSocket upgrade and its process-local session map. handleGatewayConnection owns challenge verification, hello, heartbeat, and normal message routing after the socket is accepted.

Production integrations must add durable pairing/public credential stores, authorization around code creation, pairing rate limits, durable jobs, and cluster-aware session routing.

Run all example checks with:

pnpm --filter openprinter-node-example check