Some improvements
This commit is contained in:
1 parent
a914bd74fe
commit
729c0be834
16 files changed
+577
-36
No files matched your search
@@ -66,9 +66,9 @@ export class NetworkClient {
|
||||
this.currAt = 0;
|
||||
|
||||
this.socket.subscribe(this._snapshotChannel(), {
|
||||
onEvent: (event, payload) => {
|
||||
onEvent: (event, payload, rawBytes) => {
|
||||
if (event === 'snapshot') {
|
||||
this._ingest(payload);
|
||||
this._ingest(payload, rawBytes);
|
||||
} else if (event === 'room-error') {
|
||||
this.onRoomError?.(payload);
|
||||
}
|
||||
@@ -188,13 +188,14 @@ export class NetworkClient {
|
||||
});
|
||||
}
|
||||
|
||||
_ingest(payload) {
|
||||
_ingest(payload, rawBytes = 0) {
|
||||
if (this.curr && payload.seq !== undefined && this.curr.seq !== undefined && payload.seq <= this.curr.seq) {
|
||||
return;
|
||||
}
|
||||
this.prev = this.curr;
|
||||
this.prevAt = this.currAt;
|
||||
this.curr = payload;
|
||||
this.curr.bytes = rawBytes;
|
||||
this.currAt = performance.now();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user