This project is a real-time Java-based chat application built using Spring Boot and WebSocket technology. It provides a responsive graphical user interface (GUI) for seamless communication between users, featuring user management, message broadcasting, and active user tracking.
- Real-time Messaging: Exchange messages instantly using WebSocket.
- User-Friendly GUI: Built using Swing for intuitive user interaction.
- Active User List: View all connected users in real time.
- Dynamic Message Layout: Automatically adjusts to the window size for better readability.
- User Connection Management: Connect, disconnect, and notify users dynamically.
Dhruv0306-Java-Chat-App/
├── HELP.md
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src/
├── main/
│ ├── java/
│ │ └── com/
│ │ └── example/
│ │ └── JavaChatApplication/
│ │ ├── JavaChatApplication.java
│ │ ├── Message.java
│ │ ├── WebSocketController.java
│ │ ├── WebSocketSessionManager.java
│ │ ├── WebsocketConfig.java
│ │ └── client/
│ │ ├── App.java
│ │ ├── ClientGUI.java
│ │ ├── MessageListener.java
│ │ ├── MyStompClient.java
│ │ ├── MyStompSessionHandler.java
│ │ └── Utilities.java
│ └── resources/
│ └── application.properties
└── test/
└── java/
└── com/
└── example/
└── JavaChatApplication/
└── JavaChatApplicationTests.java
- Java Development Kit (JDK) 21 or later
- Maven 3.8+
- Spring Boot 3.4.0
-
Clone the repository:
git clone https://github.com/Dhruv0306/JavaChatApp.git cd Dhruv0306-Java-Chat-App
-
Build the application using Maven:
./mvnw clean install
-
Run the Spring Boot server:
./mvnw spring-boot:run
-
Start the client application:
java -jar target/JavaChatApplication-0.0.1-SNAPSHOT.jar
-
Enter a username when prompted to join the chat.
- WebSocketController: Handles WebSocket endpoints for messaging and user management.
- WebSocketSessionManager: Manages active user sessions and broadcasts updates.
- WebsocketConfig: Configures WebSocket endpoints and message brokers.
- ClientGUI: Provides the main graphical interface for users.
- MyStompClient: Manages WebSocket connections for the client.
- Utilities: Helper functions for GUI styling and layout adjustments.
Modify src/main/resources/application.properties
to set application-specific properties. Default WebSocket endpoint is configured as:
spring.application.name=JavaChatApplication
Run unit tests using:
./mvnw test
Tests are located in src/test/java/com/example/JavaChatApplication/
.
Feel free to fork the repository and submit pull requests. Contributions are welcome to improve functionality, fix bugs, or enhance the user experience.
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Dhruv Patel
- GitHub: Dhruv0306
Enjoy chatting!