From: Carl Worth Date: Wed, 7 Dec 2022 06:35:20 +0000 (-0800) Subject: Add code to submit image generation instructions to the server X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=1e105bc031bb09cc823f656a5e0c1601f18a1d4f;p=zombocom-ai Add code to submit image generation instructions to the server Though the server is just printing them on the console for now, and not actually doing any image generation yet. --- diff --git a/index.html b/index.html index 931efa6..f438b60 100644 --- a/index.html +++ b/index.html @@ -34,14 +34,13 @@ - +
@@ -49,15 +48,6 @@
-
@@ -112,11 +102,17 @@ mute.addEventListener("click", () => { diff --git a/index.js b/index.js index 5e88926..249537f 100644 --- a/index.js +++ b/index.js @@ -42,15 +42,22 @@ app.get('/index.html', (req, res) => { }); io.on('connection', (socket) => { + // Replay old comments to a newly-joining client comments.forEach((comment) => { socket.emit('comment', comment) }); + // When any client comments, send that to all clients (including sender) socket.on('comment', (comment) => { io.emit('comment', comment); comments.push(comment); }); + + // Generate an image when requested + socket.on('generate', (request) => { + console.log(`Generating image with code=${request['code']} and prompt=${request['prompt']}`); + }); }); server.listen(port, () => {