unstale

npm / mqtt

mqtt

What changed in mqtt 3 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

11 breaking4 security8 new APIs and options1 behavior and defaults14 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

mqtt 529 changes

Breaking changes 10

  • An acknowledgment that does not match the pending command for its message id is dropped and reported through error.

    5.16.0release notes

  • A getter provides access to negotiated keepalive now that CONNACK no longer mutates the options object.

    5.16.0release notes

  • A getter provides access to negotiated server properties now that CONNACK no longer mutates the options object.

    5.16.0release notes

  • The cap measures total wire size rather than Remaining Length, so it triggers on packets a few bytes smaller than before.

    5.16.0release notes

  • CONNACK properties no longer mutate the caller's options object; read negotiated values from the client getters instead.

    5.16.0release notes

  • Invalid or non-integer values outside 1..65535 are ignored; 65535 is enforced and advertised instead.

    5.16.0release notes

  • Protocol violations drop the connection, with reconnect remaining armed.

    5.16.0release notes

  • A refused CONNACK always closes the socket, including when reconnectOnConnackError is false.

    5.16.0release notes

  • Creating an MqttClient instance now requires the new keyword.

    5.0.0release notes

  • Support for Node.js 12–14 was dropped.

    5.0.0release notes

Security 4

  • Unsolicited or out-of-spec AUTH packets are rejected rather than crashing the process.

    5.16.0release notes

  • The advertised Receive Maximum is enforced for inbound QoS 2 messages, preventing an unbounded incoming store.

    5.16.0release notes

  • SUBACK reason-code counts are checked against subscriptions sent, preventing crashes or incorrect subscription reports.

    5.16.0release notes

  • Unsolicited MQTT 5 Topic Aliases are rejected rather than crashing the process; the unregistered-alias case reports reason code 0x82.

    5.16.0release notes

New APIs and options 5

  • PacketPump is newly exported from src/lib/shared.ts.

    5.16.0release notes

  • PendingCommand is newly exported from the entry point.

    5.16.0release notes

  • Topic validation functions are exported for external use.

    5.15.0release notes

  • Promises support was added.

    5.0.0release notes

  • An option to disable writeCache was added, alongside a fix for a leak in subscriptions.

    5.0.0release notes

Fixes and other changes 10

  • Reconnects instead of ending a client whose stream is already destroyed.

    5.16.1release notes

  • Schedules browser process.nextTick with queueMicrotask.

    5.16.1release notes

  • AUTH reason code 0 now ends the exchange successfully instead of producing an error with an empty reason string.

    5.16.0release notes

  • Duplicate CONNACK packets are rejected instead of rerunning connection setup mid-session.

    5.16.0release notes

  • An explicit servername (SNI) is no longer overwritten when connecting over TLS.

    5.15.2release notes

  • WebSocket connections now support relative URLs.

    5.15.2release notes

  • Added the missing export of DefaultMessageIdProvider.

    5.0.0release notes

  • Fixed a problem where the publish callback was invoked twice.

    5.0.0release notes

  • Fixed the placement of topicAliasMaximum under Connect properties.

    5.0.0release notes

  • Added the missing export of UniqueMessageIdProvider.

    5.0.0release notes

mqtt 43 changes

New APIs and options 2

Behavior and default changes 1

  • Client error handling changed; the notes do not specify further details.

    4.0.0release notes

mqtt 36 changes

Breaking changes 1

  • The connect event is emitted after processing of outgoingStore is completed.

    3.0.0release notes

New APIs and options 1

Fixes and other changes 4

  • Processes a disconnect packet without fully destroying the connection.

    3.0.0release notes

  • Completed incoming QoS 2 messages are deleted.

    3.0.0release notes

  • Fixes publish being interrupted during stored packet processing.

    3.0.0release notes

  • Fixes MQTT 5 properties in subscribe.

    3.0.0release notes