Skip to content

saikrishna488/wchat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Chat App Documentation

The chat app allows users to connect with each other and chat in real-time. There are two main features of the app:

Random chat - Users can connect to a random user and chat with them. Chat rooms - Users can create or join chat rooms with a unique room ID and chat with other users who are also in the same room. Backend The backend of the chat app is built using Node.js, Express, and Socket.IO. Socket.IO is a library that enables real-time, bidirectional and event-based communication between the browser and the server.

Installation

To install the backend dependencies, run the following command:

Copy code

npm install express socket.io

Configuration

The backend server can be configured in the server.js file. Here are the main configurations:

Socket.IO events

Socket.IO enables real-time communication between the browser and the server using events. The following events are used in the chat app:

connection: Triggered when a user connects to the server. disconnect: Triggered when a user disconnects from the server. join-room: Triggered when a user joins a chat room. leave-room: Triggered when a user leaves a chat room. message: Triggered when a user sends a message in a chat room.

Frontend

The frontend of the chat app is built using React and Next.js. The app is designed to be responsive and work on both desktop and mobile devices.

Installation

To install the frontend dependencies, run the following command:

Copy code

npm install react next react-dom socket.io-client

Pages

The app has the following pages:

index.js: The landing page of the app. Allows users to choose between random chat or chat rooms. random.js: The page for one-on-one random chat. [id]/index.js: The page for creating or joining chat rooms.

Components

The app has several reusable components that are used across the pages:

Header: The header of the app, which contains the logo and navigation links. UserList: A list of users in a chat room. ChatBox: The box where messages are displayed and new messages are typed.

Socket.IO client

The Socket.IO client is used to connect to the backend server and listen for events. The following events are used in the chat app:

connect: Triggered when the client connects to the server. disconnect: Triggered when the client disconnects from the server. join-room: Triggered when the client joins a chat room. leave-room: Triggered when the client leaves a chat room. message: Triggered when a message is received in

About

A chat App where users can connect to random users and chat also users can create and join chatrooms with room code and username

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published