aboutsummaryrefslogtreecommitdiff
path: root/static/src/network.ts
diff options
context:
space:
mode:
Diffstat (limited to 'static/src/network.ts')
-rw-r--r--static/src/network.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/static/src/network.ts b/static/src/network.ts
index f707148..fac96df 100644
--- a/static/src/network.ts
+++ b/static/src/network.ts
@@ -66,8 +66,7 @@ export class WebSocketEventQueue implements EventQueue {
private listen_to(websocket: WebSocket) {
websocket.onmessage = ({ data }) => {
- const [event_type, event_data] = JSON.parse(data);
- this.queue.push({ event_type, data: event_data } as Event);
+ this.queue = this.queue.concat(JSON.parse(data));
};
}
}
@@ -84,6 +83,9 @@ export class WebsocketEventPublisher implements EventPublisher {
}
public publish() {
+ if (this.queue.length === 0) {
+ return;
+ }
this.websocket.send(JSON.stringify(this.queue));
this.queue = [];
}