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) => {