finds.dev← search

// the find

mqttjs/MQTT.js

★ 9,081 · TypeScript · NOASSERTION · updated May 2026

The MQTT client for Node.js and the browser

MQTT.js is the de facto standard MQTT client for JavaScript — runs in Node.js and browsers over WebSocket. It handles MQTT 3.1, 3.1.1, and 5.0, with built-in reconnection, QoS 0/1/2, and session persistence. If you're doing IoT or real-time messaging in a JS stack, this is the library you reach for.

Full MQTT 5.0 support including topic aliases, user properties, and reason codes — not just bolted on as an afterthought. The async API (connectAsync, publishAsync, subscribeAsync) was added properly alongside the callback API rather than replacing it, so existing code doesn't break. TypeScript rewrite in v5 means the type definitions are accurate because they're generated from the source, not hand-maintained. The transformWsUrl and createWebsocket hooks for WebSocket reconnection are genuinely useful — most IoT cloud providers require signed URLs that expire, and this covers that case cleanly.

The in-memory store for QoS 1/2 inflight messages is lost on process restart — there's no built-in durable store, and the third-party options (mqtt-level-store, mqtt-jsonl-store) are maintained separately with their own lag. Browser support is WebSocket-only, which is expected, but the error surfacing is deliberately limited by browser security policy — you will get silent failures that are easy to misdiagnose. The reconnectOnConnackError option defaults to false, meaning a broker CONNACK rejection won't trigger reconnect by default, which surprises people integrating with brokers that do temporary auth failures. MQTT 5.0 support still carries a 'experimental' note in the v3 changelog that was never cleaned up, which undermines confidence even though the implementation is functional.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →