diff options
| author | Elizabeth Hunt <elizabeth@simponic.xyz> | 2024-09-02 21:05:43 -0700 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth@simponic.xyz> | 2024-09-02 21:05:43 -0700 |
| commit | 9f5e81327be33489d9bb912de503cd01d6ba7dca (patch) | |
| tree | 913d1d3ca9acd4d13e8f952d2c812c63868cc574 /static/src/network.ts | |
| parent | d35ab6cc851d3fc85f55cfb5676f8dc3552fab24 (diff) | |
| download | kennel.hatecomputers.club-9f5e81327be33489d9bb912de503cd01d6ba7dca.tar.gz kennel.hatecomputers.club-9f5e81327be33489d9bb912de503cd01d6ba7dca.zip | |
get it compiling
Diffstat (limited to 'static/src/network.ts')
| -rw-r--r-- | static/src/network.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/static/src/network.ts b/static/src/network.ts index 0d4e216..f707148 100644 --- a/static/src/network.ts +++ b/static/src/network.ts @@ -71,3 +71,20 @@ export class WebSocketEventQueue implements EventQueue { }; } } + +export class WebsocketEventPublisher implements EventPublisher { + private queue: Event[]; + + constructor(private readonly websocket: WebSocket) { + this.queue = []; + } + + public add(event: Event) { + this.queue.push(event); + } + + public publish() { + this.websocket.send(JSON.stringify(this.queue)); + this.queue = []; + } +} |
