Documentation
FAQ
Printer Emulators
Code Examples
Network Information
Data Filtering
Getting Started
Using QZ Tray
Signing Messages
API Overrides
Command Line Usage
Licensing/Renewing
Generate Certificate
Certificate Renewal
Company Branded
Signing Messages
General Licensing Information
FAQ
Printer Emulators
Code Examples
Network Information
Data Filtering
Getting Started
Using QZ Tray
Signing Messages
API Overrides
Command Line Usage
Licensing/Renewing
Generate Certificate
Certificate Renewal
Company Branded
Signing Messages
General Licensing Information
Socket
- ✅ 2.1 | ⛔ 2.0 | ⛔ 1.9 | ...
Since 2.1.3
Establish a two-way TCP socket connection using the qz.socket API.
qz.socket.open('192.168.1.1', '80').then(() => {
console.log("Socket opened");
}).catch(err => {
console.error("An exception occurred opening the socket", err);
});qz.socket.sendData('192.168.1.1', '80', "some data!").catch(err => {
console.error("An exception occurred sending data to the socket", err);
});qz.socket.setSocketCallbacks(evt => {
if (evt.type !== 'ERROR') {
console.log('Socket', evt.host, evt.port, 'received response', evt.response);
} else {
console.error(evt.exception);
}
});qz.socket.close('192.168.1.1', '80').then(() => {
console.log("Socket closed");
}).catch(err => {
console.error("An exception occurred closing the socket", err);
});