From 024a616cdfeb6f6f9c4f521071bfa2421ba8d8c0 Mon Sep 17 00:00:00 2001 From: joak Date: Sun, 11 Feb 2024 22:36:54 +0100 Subject: [PATCH] comments --- index.js | 12 ++++----- public/index.html | 64 +++++++++++++++++++++++------------------------ 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/index.js b/index.js index 5a7f955..7b574ef 100644 --- a/index.js +++ b/index.js @@ -7,12 +7,12 @@ const io = new Server(server); app.use(express.static('public')); -io.on('connection', (socket) => { - console.log('a user connected'); +io.on('connection', (socket) => { + console.log('a user connected'); //console log if a user connceted - socket.on('picture', (line) => { - console.log(line); - socket.broadcast.emit("dingdong",line); + socket.on('picture', (line) => { //if the message "picture" comes it will do this function. the message is called line + console.log(line); //logs the incoming message called line + socket.broadcast.emit("dingdong",line); //it broadcasts it to the other connected clients https://socket.io/docs/v4/tutorial/step-5 }); socket.on('disconnect', () => { @@ -20,6 +20,6 @@ io.on('connection', (socket) => { }); }); -server.listen(3000, () => { +server.listen(3000, () => { //if you would like to change the port change the number console.log('listening on *:3000'); }); diff --git a/public/index.html b/public/index.html index 5c55512..8ac6678 100644 --- a/public/index.html +++ b/public/index.html @@ -14,7 +14,7 @@

drawing editor

-
+
Stroke width:
Color: Brush: