Some improvements

This commit is contained in:
armel committed 2026-09-08 22:33:51 +02:00
1 parent a914bd74fe
commit 729c0be834
16 files changed
+577 -36

No files matched your search

+4 -3
View File
@@ -42,7 +42,8 @@ export class SocketClient {
} catch {
return;
}
this._handle(msg);
const rawBytes = typeof event.data === 'string' ? new Blob([event.data]).size : 0;
this._handle(msg, rawBytes);
};
socket.onclose = () => {
@@ -76,7 +77,7 @@ export class SocketClient {
this.socketId = null;
}
_handle(msg) {
_handle(msg, rawBytes = 0) {
const { event, channel } = msg;
if (event === 'pusher:connection_established') {
@@ -117,7 +118,7 @@ export class SocketClient {
return;
}
}
this.handlers.get(channel)?.onEvent?.(event, payload);
this.handlers.get(channel)?.onEvent?.(event, payload, rawBytes);
}
}