How stszone/aspos-print-agent works
ASPOS Print Agent is an on-site Node.js service that receives print jobs from ASPOS over Reverb, prints raw ESC/POS bytes to network printers, and reports outcomes. The main workflow is connection → entry-point job handling → worker → printer, with failed jobs persisted and retried; successful receipts also enter local history for emergency reprints. The agent additionally exposes health and local-receipt endpoints and sends heartbeats. Relationships follow the README and shown source/import references; installer and service-management files are outside the runtime map.
Main entry points: index.js Agent entry point · backend.js Backend API client · connection.js Reverb connection · health.js Health and reprint API
Components 15
Agent runtime
- Agent entry point
src/index.js - Configuration
src/config.js - Logging
src/logger.js
Job delivery
- Reverb connection
src/connection.js - Backend API client
src/backend.js - Print job worker
src/worker.js - TCP printer dispatch
src/printer.js
Local persistence
- Retry queue
src/buffer.js - Print history
src/history.js - SQLite runtime
src/sqljs.js
Operations
- Health and reprint API
src/health.js
Other components
- POS staff
- Admin UI
- ASPOS backend
- Network printer
Connections 31
- Agent entry point → Configuration: loads
src/index.js - Agent entry point → Retry queue: opens and manages
src/index.js - Agent entry point → Print history: opens and records
src/index.js - Agent entry point → Reverb connection: starts
src/index.js - Agent entry point → Health and reprint API: starts
src/index.js - Agent entry point → Print job worker: processes jobs with
src/index.js - Agent entry point → Backend API client: reports heartbeat
src/index.js - Reverb connection → Agent entry point: delivers job events
src/index.js - Reverb connection → Backend API client: authenticates channel
src/connection.js - Backend API client → ASPOS backend: calls API
src/backend.js - Reverb connection → ASPOS backend: receives WebSocket jobs
README.md - Print job worker → TCP printer dispatch: sends ESC/POS bytes
src/worker.js - TCP printer dispatch → Network printer: writes TCP
README.md - Print job worker → Backend API client: reports result
src/worker.js - Agent entry point → Retry queue: queues and retries
src/index.js - Agent entry point → Print history: records successful receipts
src/index.js - Agent entry point → Backend API client: reports abandoned jobs
src/index.js - Health and reprint API → Print history: reads recent receipts
src/health.js - Health and reprint API → Agent entry point: dispatches reprint callback
src/index.js - Admin UI → Health and reprint API: requests status or reprint
README.md - POS staff → Admin UI: requests reprint
- Retry queue → SQLite runtime: initializes database
src/buffer.js - Print history → SQLite runtime: initializes database
src/history.js - Reverb connection → Configuration: reads settings
src/connection.js - Backend API client → Configuration: reads credentials and URL
src/backend.js - Health and reprint API → Configuration: reads endpoint settings
src/health.js - Logging → Configuration: reads log level
src/logger.js - Retry queue → Logging: logs queue events
src/buffer.js - Print history → Logging: logs history events
src/history.js - Print job worker → Logging: logs processing
src/worker.js - TCP printer dispatch → Logging: logs dispatch
src/printer.js