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
package/src/lib/connect/ws.ts
CHANGED
|
@@ -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)
|