• Download
  • Demo
  • Buy
  • API
  • Docs
  • Support
  • About
  • Contact
  • Login
API Home
Namespaces
qzapiconfigsfilehidnetworkingprinterssecurityserialsocketusbwebsocket
API Home
Namespaces
qzapiconfigsfilehidnetworkingprinterssecurityserialsocketusbwebsocket

Namespace: websocket

qz.websocket

Calls related specifically to the web socket connection.
Source:
  • qz-tray.js, line 1066

Members

(static) getNetworkInfo

Deprecated:
  • Since 2.1.0. Please use qz.networking.device() instead
Source:
  • qz-tray.js, line 1220

Methods

(static) connect(optionsopt) → {Promise.<(null|Error)>}

Call to setup connection with QZ Tray on user's system.
Parameters:
Name Type Attributes Description
options Object <optional>
Configuration options for the web socket connection.
Properties
Name Type Attributes Default Description
host string | Array.<string> <optional>
['localhost', 'localhost.qz.io'] Host running the QZ Tray software.
port Object <optional>
Config options for ports to cycle.
Properties
Name Type Attributes Default Description
secure Array.<number> <optional>
[8181, 8282, 8383, 8484] Array of secure (WSS) ports to try
insecure Array.<number> <optional>
[8182, 8283, 8384, 8485] Array of insecure (WS) ports to try
usingSecure boolean <optional>
true If the web socket should try to use secure ports for connecting.
keepAlive number <optional>
60 Seconds between keep-alive pings to keep connection open. Set to 0 to disable.
retries number <optional>
0 Number of times to reconnect before failing.
delay number <optional>
0 Seconds before firing a connection. Ignored if options.retries is 0.
Source:
  • qz-tray.js, line 1101
Returns:
Type
Promise.<(null|Error)>

(static) disconnect() → {Promise.<(null|Error)>}

Stop any active connection with QZ Tray.
Source:
  • qz-tray.js, line 1173
Returns:
Type
Promise.<(null|Error)>

(static) getConnectionInfo() → {Object.<{socket: String, host: String, port: Number}>}

Source:
  • qz-tray.js, line 1227
Returns:
Details of active websocket connection
Type
Object.<{socket: String, host: String, port: Number}>

(static) isActive() → {boolean}

Check connection status. Active connection is necessary for other calls to run.
Source:
  • qz-tray.js, line 1080
See:
  • connect
Returns:
If there is an active connection with QZ Tray.
Type
boolean

(static) setClosedCallbacks(calls)

List of functions called for any connection closing event outside of an API call.

Also called when websocket#disconnect is called.

Parameters:
Name Type Description
calls function | Array.<function()> Single or array of Function({Event} event) calls.
Source:
  • qz-tray.js, line 1204

(static) setErrorCallbacks(calls)

List of functions called for any connections errors outside of an API call.

Also called if websocket#connect fails to connect.

Parameters:
Name Type Description
calls function | Array.<function()> Single or array of Function({Event} event) calls.
Source:
  • qz-tray.js, line 1192
Documentation generated by JSDoc 3.6.11

© 2023 qz | Privacy Policy