Skip to main content

Decode your first web packet

Open web/ in your installed SDK directory, or extract the static web ZIP. Both contain a ready-to-run module, the Rust decoder binary, TypeScript declarations, and the same example.klv as the native SDK. Start with no token set.

The sample ST 0601 packet​

The examples below decode this 87-byte MISB ST 0601 revision 19 packet, supplied as example.klv.

Hex dump of the ST 0601 sample packet, from the 16-byte key through the checksum 68 9C
Open the full-size hex dump
  • Key. The first 16 bytes, 06 0E 2B 34 02 0B 01 01 0E 01 03 01 01 00 00 00, identify the ST 0601 UAS Datalink Local Set.
  • Length. The next byte, 46 in hexadecimal, is the BER length. It declares 70 bytes of value, including the checksum item.
  • Value. The local set contains tag-length-value items. For example, 41 01 13 means tag 65 has a one-byte value of 0x13, which identifies revision 19. Tag 3 carries Test mission and tag 10 carries Test platform.
  • Checksum. The last item is 01 02 68 9C. Tag 1 has a two-byte checksum value of 0x689C (26780), computed over the packet bytes through 01 02.

Use Node.js 22 or later for these commands. In the extracted directory run:

node example.mjs
example.mjs
import {createDecoder} from './index.mjs';
import {readFile} from 'node:fs/promises';

// Start the decoder with an optional web license token.
const decoder = await createDecoder({licenseToken: process.env.LIBMISB_WEB_TOKEN});
try {
// Read the requested file or fall back to the bundled packet.
const packet = await readFile(process.argv[2] ?? new URL('./example.klv', import.meta.url));

console.log(decoder.licenseStatus().mode);
// Print the response as JSON text so large integer values retain their precision.
console.log(decoder.requestJSON(packet));
} finally {
// Release the decoder even if reading or decoding the packet fails.
await decoder.close();
}

To use the npm distribution in your own application, run the following from the directory containing its package.json. For a new application, create the directory and run npm init -y there first. Substitute the path to your supplied tarball.

npm install --offline ./impleotv-libmisb-wasm-VERSION.tgz
node node_modules/@impleotv/libmisb-wasm/example.mjs

The package entrypoint is import {createDecoder} from '@impleotv/libmisb-wasm'. Its loader resolves the bundled binary relative to the module.

Recognize the result​

Both examples show demo on the first line, followed by this JSON envelope. Key order and whitespace may vary.

{
"status": "ok",
"value": {
"Checksum": 9400,
"MissionID": "Test mission",
"PlatformDesignation": "Test platform",
"PlatformHeadingAngle": 147.99908445868618,
"PlatformTailNumber": "24",
"PrecisionTimestamp": 1795433587745520,
"SensorLatitude": 41.093374323609,
"SensorLongitude": -104.8687724978052,
"Version": 19
}
}

PrecisionTimestamp is in microseconds. Demo mode omits SensorTrueAltitude and reports a checksum of 9400 for the filtered packet. A licensed decode includes SensorTrueAltitude and reports the original checksum 26780.

Keep the envelope as text when forwarding exact integer values. Next, decode a stream in TypeScript.