@dnotifier-realtime/dnotifier 1.0.6 → 1.0.8

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnotifier-realtime/dnotifier",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Real-time notification & messaging SDK",
5
5
  "main": "src/dnotifier.js",
6
6
  "type": "module",
@@ -99,9 +99,15 @@ export class WebsocketTransport extends EventEmitter {
99
99
  });
100
100
 
101
101
  // 📩 MESSAGE
102
- this._on("message", (event, isBinary) => {
102
+ this._on("message", async (event, isBinary) => {
103
103
  console.log('event', event)
104
- const data = event?.data ?? event;
104
+ var data = event?.data ?? event;
105
+
106
+ // Convert Blob -> ArrayBuffer in browser
107
+ if (typeof Blob !== "undefined" && data instanceof Blob) {
108
+ data = await data.arrayBuffer();
109
+ }
110
+
105
111
  const chunk = decodePacket(data);
106
112
  if (chunk) {
107
113
  this.emit("message", chunk, isBinary);