From: Carl Worth Date: Wed, 7 Dec 2022 08:58:06 +0000 (-0800) Subject: Replay previous images to a client when it first connects X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=344784f27434ed505982ffc74558af98ebb1a5b9;hp=2bc133296a6a76a8705d1cc029ae900c39f339c2;p=zombocom-ai Replay previous images to a client when it first connects so that the images are just as persistent as the comments --- diff --git a/index.js b/index.js index 8dadeab..0ee5e43 100644 --- a/index.js +++ b/index.js @@ -48,10 +48,13 @@ app.get('/index.html', (req, res) => { io.on('connection', (socket) => { - // Replay old comments to a newly-joining client + // Replay old comments and images to a newly-joining client state.comments.forEach((comment) => { socket.emit('comment', comment) }); + state.images.forEach((image) => { + socket.emit('image', image) + }); // When any client comments, send that to all clients (including sender) socket.on('comment', (comment) => {