]> git.cworth.org Git - zombocom-ai/commit
Add a new 'reset' event from server to client before replay
authorCarl Worth <cworth@cworth.org>
Thu, 8 Dec 2022 06:28:19 +0000 (22:28 -0800)
committerCarl Worth <cworth@cworth.org>
Thu, 8 Dec 2022 06:28:19 +0000 (22:28 -0800)
commitecd4364ec599f5f14ff8825ac74bee717151fe4c
tree1cb4a92d1508e3bbc6fd9a0456cd185c348edb3d
parent3466003e498d45dab79737107b7ae8f6053a54ae
Add a new 'reset' event from server to client before replay

This handles the case of a client that persists across a server
restart, (or various other disconnect/reconnect scenarios).

Prior to this commit, the client could end up with multiple copies of
images through the following sequence:

1. A client is chugging along with the server and has a set of images

2. The server is stopped and restarted

3. When the server comes up again it sees the client connect and so it
   replays all images

Boom. The client now has multiple copies of any image it already had.

To fix this, the server now sends a 'reset' event prior to sending any
replay of images. When the client gets this, it clears out all images
it has.
index.html
index.js