This is a simple chat application using Node.js, Express, and Socket.IO. The application allows users to join a chat room, send messages to all users, and send private messages to specific users.
-
Clone the repository:
git clone https://github.com/mearjuntripathi/chat-example.git
-
Navigate to the project directory:
cd chat-example
-
Install dependencies:
npm install
-
Run the server:
npm start
-
Open your browser and go to http://localhost:3000.
-
Enter your name and join the chat room.
-
Start chatting with other users.
-
Joining and Leaving:
- Users can join the chat room by entering their name.
- When a user joins, a broadcast message notifies all users about the new user.
- Users receive a message when someone leaves the chat room.
-
Public Chat:
- Users can send messages that are broadcasted to all connected users.
-
Private Messaging:
- Users can send private messages to a specific user by selecting their name.
- Node.js: JavaScript runtime for server-side development.
- Express: Web application framework for Node.js.
- Socket.IO: Real-time bidirectional event-based communication.
/html
: Contains HTML files for the front end./html/public
: Static assets like stylesheets and client-side scripts.index.html
: Main HTML file for the chat application.app.js
: Server-side script for handling socket connections and messages.
Socket.IO enables real-time, bidirectional, and event-based communication. It works on every platform, browser, or device, focusing equally on reliability and speed.
- Socket.IO Documentation: Refer to the official Socket.IO documentation for detailed information on using Socket.IO.
This project is licensed under the MIT License - see the LICENSE file for details.