const secureSend = require('./secureSendClient.js'); const options = { hmacKey: 'supersecure', hashByteLength: 32, randDataLength: 100, port: 777, ip: '192.168.0.6', onConnect: () => { console.log('Connected'); } } const cmds = { getGateState:{ cmd: 0, responses: [0x00, 0x01, 0x02] /* 0: Closed 1: Open 2: Middle */ }, switchGate: { cmd: 1, responses: [0x00] /* 0: Cmd received */ }, switchLight: { cmd: 2, responses: [0x00, 0x01] /* 0: now closed 1: now Open */ } }; secureSend(options, cmds.switchGate) .then(res => { console.log('The response ->'); console.log(res); }) .catch(err => { console.log('Catched Error ->'); console.log(err); }); setTimeout(()=>{},6000);