mqtt 5.10.0 → 5.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mqtt",
3
3
  "description": "A library for the MQTT protocol",
4
- "version": "5.10.0",
4
+ "version": "5.10.1",
5
5
  "contributors": [
6
6
  "Adam Rudd <adamvrr@gmail.com>",
7
7
  "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
@@ -256,9 +256,11 @@ const browserStreamBuilder: StreamBuilder = (client, opts) => {
256
256
  /**
257
257
  * https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/message_event
258
258
  */
259
- function onMessage(event: MessageEvent) {
259
+ async function onMessage(event: MessageEvent) {
260
260
  let { data } = event
261
261
  if (data instanceof ArrayBuffer) data = Buffer.from(data)
262
+ else if (data instanceof Blob)
263
+ data = Buffer.from(await new Response(data).arrayBuffer())
262
264
  else data = Buffer.from(data as string, 'utf8')
263
265
  if (proxy && !proxy.destroyed) {
264
266
  proxy.push(data)