Express WS connector (UISP-Connector)
A typescript light weight WebSocket connector for interaction with UISP
API
The main function is located in src/index.js
, called by the device with following arguments, further
in detail described in src/types.d.ts
:
- deviceToken
Is a unique string identifying a single device
- getExpressData
A function injected to the UISP-Connector returning a promise with device data as per UniFiNetworkStatusV2
specification.
- customLogger
Custom logger is an object containing at least three functions: error(args), info(args), debug(args).
Use of custom logger is optional. If one is not injected to UISP-Connector, an inner implementation
will be used as fallback.
- saveAeskey
A function injected to UISP-Connector is used to persist a device specific AES key and UISP WS url when
one is retrieved from UISP upon handshake of otherwise during connection, it may be of a string
or undefined
type, undefined
to be used to disconnect UISP-Connector from UISP.
If UISP-Connector is disconnected, its device specific AES key is deleted and UISP-Connector finishes its
function. In case the device is to connect again to UISP, the UISP-Connector must be called once again
with master AES key and exchange for a device specific AES key must take place once again.
- getAesKey
A function injected do UISP-Connector is used to retrieve a persisted device specific aes key and UISP WS url,
undefined
to be returned if there is none.