README
linq-discovery
npm library to discover linq devices using UDP broadcast
Install
yarn add linq-discovery
or
npm i linq-discovery
How To Use
import {Discovery} from 'linq-discovery'
const UDP_PORT = 7123 // Default Port used
const disco = new Discovery(UDP_PORT)
.on('new', (device) => { // New device discovered
console.dir(device)
})
.on('message', (device) => { // Un-filtered UDP message received
console.log(`${JSON.stringify(device)}`)
})
Console Output Example
Device {
product: 'linq2',
id: 'cCzyUmwbgItEvWvzIesdoF-7seAUjH79LGC5zfTyqfs=',
ip: '192.168.1.57',
http: 80,
https: 443,
mqtt: 1883,
mqtts: 8883
}
To get a list of devices discovered since application started
let array_of_devices = disco.get_devices()
To clear the list of devices discovered
disco.clear()