0.2.1 • Published 7 months ago
@jliuhtonen/nightvision v0.2.1
Nightvision
Lenbrook Service Discovery Protocol implementation for Node.js. See specification.
This library provides you with a client and server implementation for the protocol that allows you to send and receive messages to discover supported devices and their capabilities.
Currently, it cannot be used to advertise services as only queries can be sent. Contributions are welcome.
Example
import { createConnection } from "nightvision"
const conn = await createConnection()
conn.onData((err, result) => {
if (err) {
console.error(err)
return
}
console.log(JSON.stringify(result, null, 2))
})
await conn.sendMessage({
type: "query",
messageType: "standard",
classIds: ["0001"],
})
As mentioned in the specification, the guideline is to send startup messages 7 times within certain time interval and delays. This is considered out of scope for this library.