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.

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';

const decoder = await createDecoder({licenseToken: process.env.LIBMISB_WEB_TOKEN});
try {
const packet = await readFile(process.argv[2] ?? new URL('./example.klv', import.meta.url));
console.log(decoder.licenseStatus().mode);
console.log(decoder.requestJSON(packet));
} finally {
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.

The first line shows demo. The JSON envelope has status ok and its value contains PrecisionTimestamp: 9007199254740993, Version: 19, and Checksum: 23503. Keep that envelope as text when forwarding exact integer values. Next, decode a stream in TypeScript.