linq.listen

linq.listen(config: number | LinQConfig): Promise

The linq.listen() method takes a port number parameter, or a configuration object. To listen with TLS termination for the embedded devices you must use the configuration object.

The linq.listen() method will create a socket for the ZMTP protocol and listen for incoming device connections. linq.listen() will return a promise when the socket is ready. This is typically the first function called to start the linqjs module.

  • see also
    • linq.on to listen for incoming alerts
    • linq.devices to get an object of connected devices indexed by serial number
    • linq.shutdown to clean up and close LinQJS module

Parameters

Parameter type description
config number | LinQConfig Config object or Port number

LinQConfig configuration object

Prop type required description
cert string Only when using TLS A pem format certificate
key string Only when using TLS A pem format key
tcp number true A pem format port number for linq listener
tcps number Only when using TLS A pem format port number for linq tls termination

Example: Listen with TLS termination

linq.listen({
   key = fs.readFileSync(process.env.TLS_KEY),
   cert = fs.readFileSync(process.env.TLS_CERT),
   tcp = 4590,
   tcps = 4591
});

Example: Listen unsecure

linq.listen(4590);