From 1b3bc22a6585688b7076797ec26ded6149f22ff3 Mon Sep 17 00:00:00 2001 From: Arne van Iterson Date: Wed, 21 Aug 2019 22:07:24 +0200 Subject: [PATCH] Going to add the ARNweb look tomorrow --- index.html | 52 +++++++++++++++++++++++++++++++++------------------- index.js | 16 ++++++++++------ 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/index.html b/index.html index 7270b28..6152702 100644 --- a/index.html +++ b/index.html @@ -2,18 +2,9 @@ Socket.IO chat - + - -
- - - -
+ +
+
+ +
+
+
+ + +
+
+
\ No newline at end of file diff --git a/index.js b/index.js index f984796..13859df 100644 --- a/index.js +++ b/index.js @@ -43,13 +43,17 @@ io.on('connection', function (socket) { // Handle messages socket.on('message_send', function (message) { // Build message data for clients - var msg = { - 'username': socket.username, - 'mailHash': socket.mailHash, - 'message': message + if (message !== '') { + var msg = { + 'username': socket.username, + 'mailHash': socket.mailHash, + 'message': message + } + // Send message to clients + io.emit('message_receive', msg); + } else { + socket.emit('message_receive', serverMsg(`Empty messages will not be sent.`)); } - // Send message to clients - io.emit('message_receive', msg); }); });