Skip to content

Incoming MQTT payloads are Uint8Array

Pre-release
Pre-release

Choose a tag to compare

@graebm graebm released this 17 Feb 19:42
· 292 commits to main since this release
69b2a50
  • API CHANGE: Incoming MQTT payloads are now type Uint8Array. This change affects the on_message event, and the topic-specific callback passed to subscribe().
    • Previously, the payload type definitions claimed they were different in the event vs the callback (Buffer for event and ArrayBuffer for callback), but in fact Buffer was passed to both in the browser implementation, while ArrayBuffer was passed to both in the node implementation. Now it's consistent and correct.
    • Users that were doing new Uint8Array(payload) in their code, like the samples were doing, should be unaffected (though the transformation is no longer necessary).
  • API ADDITION: The MQTT on_message event, and the topic-specific callback passed to subscribe(), have added dup, qos, and retain params.
    • This is a backwards compatible change, since users are free to pass a callback that takes less params