Install this package simply using npm:
npm install slmf-http-connector
Let's begin by starting the connector:
const { SlmfHttpConnector } = require("slmf-http-connector");
const connector = new SlmfHttpConnector({
        accumulationPeriod : 500,
        maxAccumulatedMessages : 3,
        maxSlmfMessages : 2,
        maxRetries: 3,
        port: 8080,
        url : "http://127.0.0.1",
});
connector.start();
Now you are ready to add location messages from your server or application:
const { BatteryStatus, TagIdFormat } = require("slmf-http-connector");
connector.addMessages({
      source: "Infrastructure",
      format: "DFT",
      tagIdFormat: TagIdFormat.IEEE_EUI_64,
      tagId: 0,
      position: {
          x: 0,
          y: 0,
          z: 0,
      },
      battery: BatteryStatus.Good,
      timestamp: new Date(),
});
The messages will be sent to the target server using POST request in XML format (ISO/IEC 24730-1:2014)
If you need to stop the connector just do:
connector.stop(); // It will not send nor receive messages until started
You can generate the library documentation inside the project folder using:
npm run docs