Welcome to the Chat Application!
This application allows users to choose a chat room from a dropdown menu and send messages to that room.
To install the Chat Application, follow these steps:
npm i express ws pug cookie-parser --saveTo run the Chat Application :
npm run startOR
node ./bin/wwwTo use the Chat Application, follow these steps:
- Select a chat room from the dropdown menu.
- Enter a message in the input field.
- Click the "Send" button to send the message to the selected chat room.
- To leave the current chat room, click the "Leave" button.
The Chat Application consists of the following files:
/Chat: This folder contains the code for the WebSocket server that sends and receives messages to and from the chat rooms.index.js: This file contains the code for the server that host html and handle websocket queries.pugtemplate: This file contains the HTML layout for the Chat
sequenceDiagram participant User participant Web Browser participant Web Server participant WebSocket Server
User ->> Web Browser: Open Chat Application
Web Browser ->> Web Server: GET /index.html
Web Server ->> Web Browser: index.html
Web Browser ->> User: Render index.html
User ->> Web Browser: Enter Username and Message
Web Browser ->> WebSocket Server: WebSocket Connect
WebSocket Server ->> Web Browser: Connection Acknowledged
User ->> Web Browser: Click Send Button
Web Browser ->> WebSocket Server: Send Message (JSON)
WebSocket Server ->> Web Browser: Receive Message (JSON)
WebSocket Server ->> WebSocket Server: Broadcast Message
Web Browser ->> User: Display Message