Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init(port, configuration) {
this.repeats = [];
this.coap = new Server();
this.coap.configuration = configuration;
this.coap.bind('/invoke', session => {
let requestObject;
if (session.payload) {
requestObject = JSON.parse(String.fromArrayBuffer(session.payload));
}
session.autoAck = false;
const path = parseQuery(session).path;
const cb = result => {
const response = session.createResponse();
if (result !== undefined) {
if (result instanceof ArrayBuffer)
response.setPayload(result, "application/octet-stream");