paho-mqtt

Eclipse Paho browser MQTT client that connects to brokers over WebSockets

Library
npm
v1.1.0
1,184stars
EPL-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
48/100Fair
Development Activity0
Maintenance20
Community84
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
76/100Good
Architecture80
Code Quality78
Innovation68
Learning Curve76

paho-mqtt is the Eclipse Paho JavaScript client, a browser-based MQTT library that connects to MQTT brokers over WebSockets. It lets web applications participate directly in MQTT messaging - publishing to topics and subscribing to receive messages - making it a common choice for IoT dashboards and real-time telemetry displays running in the browser.

Built as part of the Eclipse Paho project, it implements the MQTT protocol semantics (quality-of-service levels, retained messages, last-will, and clean sessions) on top of a WebSocket transport, exposing them through a callback-driven Client and Message API.

What You Get

  • A browser MQTT Client that connects to brokers over WebSockets
  • Publish and subscribe with QoS 0/1/2, retained messages, and last-will support
  • A Message object model for building and receiving payloads
  • Connection lifecycle callbacks (onConnectionLost, onMessageArrived) for event handling

Common Use Cases

  • Building browser-based IoT dashboards that display live device telemetry
  • Sending commands to devices from a web UI over MQTT
  • Receiving real-time updates in a web app via a WebSocket-capable MQTT broker

Under The Hood

Architecture - The library is delivered as a single paho-mqtt.js module (src/) exposing a Client and a Message type. The Client wraps a WebSocket connection and drives an internal state machine that frames MQTT control packets (CONNECT, PUBLISH, SUBSCRIBE, PUBACK, etc.), handles QoS acknowledgement flows, and reconnection, surfacing events through user-assigned callbacks.

Tech Stack - Pure JavaScript targeting the browser, with WebSockets as the transport (no Node net sockets). It requires an MQTT broker configured to accept MQTT-over-WebSocket connections, and packages a Maven pom.xml reflecting its Eclipse project origins.

Code Quality - A mature, widely forked Eclipse Foundation project with a src/test suite and an established release history, though development is now largely inactive. The single-file client is well-documented and long battle-tested in production IoT deployments.

API Design - The API is callback-driven and MQTT-idiomatic: construct a Client with host/port/clientId, assign onMessageArrived and onConnectionLost, then connect(), subscribe(), and send(). It predates promises, so flows are event-based, but the surface maps directly onto MQTT concepts and is easy to follow.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search