BLEMeshJS

BLEMeshJS

Build Bluetooth Mesh apps with a fast first success path.

Why this SDK exists

BLEMeshJS exists so you can build Bluetooth Mesh features in TypeScript without rebuilding provisioning, transport setup, key handling, and model messaging from scratch.

If you are here, you probably want one of these outcomes:

  • Connect to an existing mesh node and send a real command.
  • Provision a new device without hand-rolling provisioning flow logic.
  • Ship one SDK mental model across web and React Native.

Get your first success in under 60 seconds

Use this when you want proof that your runtime is configured correctly.

  1. Install the runtime package.
  2. Create the mesh manager.
  3. Scan and connect to a provisioned proxy.
yarn add @blemeshjs/sdk-web
import { MeshNetworkManager, createMesh } from "@blemeshjs/sdk-web";

const mesh = await createMesh({
	meshNetworkManager: MeshNetworkManager.instance,
});

if (!mesh.isNetworkCreated) {
	await mesh.createNewMeshNetwork();
}

await new Promise<void>((resolve, reject) => {
	const offProxy = mesh.connection.on("scan:new-proxy", async (proxy) => {
		try {
			await mesh.connection.connect(proxy);
			mesh.connection.stopScan();
			offProxy();
			offError();
			resolve();
		} catch (error) {
			reject(error);
		}
	});

	const offError = mesh.connection.on("ble:error", (error) => {
		offProxy();
		offError();
		reject(error);
	});

	mesh.connection.scan({ timeout: 10_000, notifyOnWaitingForAdvertisements: true });
});
yarn add @blemeshjs/sdk-react-native \
	@react-native-async-storage/async-storage \
	react-native-ble-plx \
	react-native-get-random-values
import { MeshNetworkManager, createMesh } from "@blemeshjs/sdk-react-native";

const mesh = await createMesh({
	meshNetworkManager: MeshNetworkManager.instance,
});

At this point, you should have a live mesh runtime

If this worked, your app can initialize BLE Mesh, discover a provisioned proxy, and open a connection.

Next, you will want to either provision a new device or send your first model command.

Choose your path

AreaWhat it gives youBest starting point
Getting StartedInstall, runtime setup, and first connectionSetup Runtime
Core ConceptsNode/element/model mental model and provisioning flowCore Concepts
Common Use CasesProvisioning and device control workflowsGuides
Advanced / Edge CasesCustom runtime wiring and operational patternsAdvanced
ReferenceAuto-generated package API docsAPI Reference

On this page