This commit is contained in:
Kacper Maj 2021-01-25 19:33:20 +01:00
commit 78b11327d4
2 changed files with 42 additions and 1 deletions

42
public/chat.html Normal file
View File

@ -0,0 +1,42 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Chat</title>
<link rel="icon" href="/img/favicon.png">
<link rel="stylesheet" href="/css/styles.min.css">
<link rel="stylesheet" href="/css/styles.css">
<meta name="description" content="Chat">
<meta name="author" content="SitePoint">
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/3.0.1/mustache.min.js"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/qs/6.6.0/qs.min.js"></script>
<script defer src="/socket.io/socket.io.js"></script>
<script defer src="/js/chat.js"></script>
</head>
<body>
<div class="chat">
<div class="chat__sidebar">
</div>
<div class="chat__main">
<div id="messages-container" class="chat__messages"> </div>
<div class="compose">
<form action="POST" id="sendMessForm">
<input placeholder="Write your message">
<button type="submit" id="formButton">Send</button>
</form>
<button id="sendLocation">Send location!</button>
</div>
</div>
</div>
</body>
</html>

View File

@ -39,7 +39,6 @@ io.on('connection', (socket) => {
'message', 'message',
generateMessage(`Welcome to the server, ${username}!`) generateMessage(`Welcome to the server, ${username}!`)
); );
socket.broadcast socket.broadcast
.to(user.room) .to(user.room)
.emit('message', generateMessage(`${user.username} has joined`)); .emit('message', generateMessage(`${user.username} has joined`));