Printing Receipts From 6,000 km Away
The integration two previous developers could not finish — a thermal printer in a Belgian kitchen, driven from Pakistan.
Role
Solo Developer
Duration
2 weeks
Year
2024
Status
In Production
6,000 km
Between developer and printer
0
Dialogs shown to staff
Overview
Every order in the restaurant ends as a paper receipt in the kitchen. No receipt, no food. This was the part of the project that had stopped previous developers, so I built it first — before agreeing to the rest of the work.
The problem
Kitchen staff work with their hands full and cannot dismiss print dialogs. If a receipt fails to print and nobody notices, an order is simply lost — the customer has paid and nothing is cooking. Two previous developers had been unable to get reliable silent printing working, which had stalled the wider project.
Constraints
- The printer was in Belgium; I was in Pakistan, with no physical access to the hardware
- No tutorial or reference implementation existed for this printer model and this use case
- Printing had to be completely silent — no dialogs, no confirmation, no staff interaction
- A dropped connection or a restarted machine must not silently lose an order
What I built
A small Electron application runs on a machine in the restaurant, holding a WebSocket connection to the server. When an order is placed, the server pushes it to the agent, which formats the receipt and sends it straight to the printer with no user interaction. Because a kitchen is not a datacentre, the agent assumes failure: print jobs enter a queue, retries are staged, and both the network connection and the WebSocket reconnect on their own. It writes an operational log so problems can be diagnosed without asking staff what they saw.
How it fits together
- Electron agent holding a persistent WebSocket to the server, using native ws rather than Socket.IO
- Print queue with multi-level retry, so a transient failure does not drop an order
- Independent reconnection handling at both the network and WebSocket layers
- Operational logging for remote diagnosis, since nobody on site can debug it
Running in production
Runs on a dedicated machine in the restaurant, connected to the thermal printer and reconnecting automatically to the production server whenever it restarts.
My role
- Researching the printer's command interface from its manual, with no reference implementation to work from
- Building a test harness and sandbox server to prove the approach before committing to it
- Writing the agent, the queue and the retry logic
- Remote diagnosis and support after installation
Outcome
- Receipts print silently and reliably from an order placed on the customer's phone
- Unblocked the wider project — this was the piece that had stopped previous attempts
- Proved the whole system was viable before the main build started
Last updated
What I Delivered
Silent printing with no staff interaction
Retry queue and independent reconnection at both network and socket layers
Built and proven before the main project was accepted
Operational logging for diagnosis without on-site access