@dnotifier-realtime/dnotifier 1.0.6 → 1.0.7
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
|
@@ -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
104
|
const 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);
|