There was an error while loading. Please reload this page.
Since 2.1.3
Establish a two-way TCP socket connection using the qz.socket API.
qz.socket
⚠️ Socket API is experimental; API subject to change.
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); });