A Free Alternative to JSPM & QZ Tray for Silent POS Printing
Build seamless web-based POS systems with direct printer access
PrinterWebSocket is a lightweight, open-source framework that enables web applications to communicate directly with POS printers through WebSocket connections. Built as a free alternative to commercial solutions like JSPM and QZ Tray, this framework allows silent printing without user prompts, making it perfect for automation and POS systems.
The framework consists of a Python WebSocket server with a built-in GUI for monitoring, and a vanilla JavaScript client that seamlessly integrates into any web application. It supports thermal POS printers using TSPL raw commands and provides real-time printer status monitoring.
Print directly without user prompts or confirmation dialogs. Perfect for automated POS systems and kiosk applications.
Real-time bidirectional communication between web apps and printers using WebSocket protocol.
Built-in GUI to monitor connected clients, server activity, and printer statuses in real-time.
Automatically list all available printers connected to the server with their current status.
Native support for TSPL commands for thermal POS printers with raw command execution.
Works on Windows, macOS, and Linux. Currently optimized for Windows with pywin32.
printer_server.py - Main WebSocket server with printer handlingrequirements.txt - Python dependenciesPrinterWebSocket.js - Vanilla JavaScript client libraryMake sure you have the following installed:
Run the WebSocket server with the built-in GUI:
The server will start on port 8765 by default. You can modify this in the server code.
Add the JavaScript client to your web application:
Establish a WebSocket connection to the printer server:
Send TSPL commands to print a receipt or label:
A full working example with printer selection:
Retrieve all printers connected to the server.
| Field | Value |
|---|---|
call |
"printers.find" |
uid |
"unique-request-id" |
Check the current version of the printer server.
Send TSPL commands to a specific printer for printing.
| Field | Value |
|---|---|
call |
"print" |
uid |
"unique-request-id" |
params.printer.name |
"Gprinter GP-3120TUC" |
params.data |
Array of TSPL commands |
Idle Printer:
Printing:
Error State:
| Code | Status | Description |
|---|---|---|
| 0 | Success / Idle | Operation completed successfully or printer is idle |
| 1 | Printing | Printer is currently processing a print job |
| 3 | Error | Printer encountered an error or operation failed |
Print kitchen orders and customer receipts automatically:
Generate product labels with barcodes:
Create shipping labels with tracking information:
You can test the server using various WebSocket clients:
The built-in GUI provides:
Problem: Cannot connect to ws://localhost:8765
Solution:
Problem: Printer doesn't appear in the list
Solution:
Problem: Print command returns error
Solution:
Problem: pywin32 installation errors
Solution:
pip install pywin32 with administrator privilegespython Scripts/pywin32_postinstall.py -install after installationCurrently optimized for Windows environments using pywin32. Support for macOS and Linux is planned but may require additional development for printer interactions.
The printer status feature has limitations due to pywin32 library constraints. It can create print jobs successfully, but real-time status monitoring may not work with all printer models.
Tested primarily with thermal POS printers using TSPL commands. Support for other printer types and command languages is in development. Community testing and contributions are welcome!
PrinterWebSocket is an open-source project and welcomes contributions! Here's how you can help:
Found a bug? Report it on our GitHub Issues page with details about your printer model and environment.
Have a fix or new feature? Fork the repository, make your changes, and submit a pull request for review.
Help others by improving documentation, adding examples, or translating content.
Test with various printer models and share your results to improve compatibility.
Get the latest version of PrinterWebSocket from GitHub:
| File | Description |
|---|---|
printer_server.py |
Main WebSocket server with printer handling and GUI |
PrinterWebSocket.js |
Vanilla JavaScript client library for web applications |
requirements.txt |
Python dependencies list |
README.md |
Project documentation and usage guide |
Have questions or need support? Get in touch with us:
PrinterWebSocket is an open-source project created as a free alternative to commercial solutions like JSPM and QZ Tray.
Author: Tawsif Torabi
Repository: github.com/TawsifTorabi/PrinterWebsocket
This project is provided as-is for educational and commercial use. While it's free to use, contributions and support are always welcome to help improve the framework for everyone.