Skip to content

Suvrat1629/Group-chat-using-Springboot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Group Chat Application

This is a real-time group chat application built using WebSockets for communication. The backend is powered by Spring Boot, while the frontend uses HTML, CSS, and JavaScript for the user interface.

Features

  • Real-time Messaging: Messages are delivered instantly to all connected users using WebSocket technology.
  • Group Chat: Multiple users can join the chat room and communicate in real time.
  • User Notifications: Users are notified when someone joins or leaves the chat.
  • Simple and Responsive UI: The frontend is designed using HTML and CSS for a clean and responsive user experience.

Technologies Used

Backend:

  • Spring Boot: Java-based framework to handle WebSocket connections and manage the chat server.
  • WebSocket: Protocol for real-time communication between client and server.

Frontend:

  • HTML: Markup language for structuring the chat interface.
  • CSS: Styling for a responsive and visually appealing UI.
  • JavaScript: Handles WebSocket connections and dynamic updates to the chat interface.

Installation and Setup

Prerequisites:

  • Java 17+ installed on your machine.

  • Maven to manage project dependencies.

  • Web browser for running the frontend.

    The backend server will start on http://localhost:8080.

WebSocket Endpoint:

  • The WebSocket connection is established at the following endpoint:
    ws://localhost:8080/chat
    

Usage

  1. Open multiple instances of the index.html file in different browser tabs to simulate multiple users.
  2. Enter your messages in the input box and click the send button or press "Enter" to broadcast the message.
  3. You will see real-time updates from all connected users.

Project Structure

group-chat-websocket/
├── src/
│   ├── main/
│   │   ├── java/
│   │   │   └── com/example/chat/
│   │   │       ├── config/        # WebSocket configuration
│   │   │       ├── controller/    # WebSocket message handling
│   │   │       └── model/         # Chat message model
│   └── resources/
│       └── application.properties # Spring Boot properties
└── frontend/
    ├── index.html                 # Chat UI
    ├── style.css                  # Chat UI styles
    └── chat.js                    # WebSocket client logic

How It Works

  • When a user sends a message, the WebSocket connection sends the message to the Spring Boot server.
  • The Spring Boot server broadcasts the message to all connected clients.
  • The client (JavaScript) listens for incoming messages and updates the chat UI in real-time.

Future Improvements

  • User Authentication: Add authentication for users to join the chat room.
  • Private Messaging: Allow users to send private messages to specific users.
  • Chat History: Store and display previous messages when users join the chat.
  • File Sharing: Enable users to share files in the chat.