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);
});
});