# WebChat **Repository Path**: sleeping071/web-chat ## Basic Information - **Project Name**: WebChat - **Description**: 网页聊天项目(微信版) - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-17 - **Last Updated**: 2026-01-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: 项目 ## README # WebChat A real-time chat web application based on WebSocket, built with Spring Boot for the backend service, supporting user login, session management, real-time message transmission, and more. ## Project Structure - **Controller**: Handles HTTP requests, including user login/register, message retrieval, and session management. - **Service/ServiceImpl**: Business logic processing, including user service, message service, and session service. - **Mapper**: Database access interfaces using MyBatis Plus. - **Pojo/Model**: Data model classes, such as User, Message, Session, etc. - **Pojo/Response**: Response wrapper classes for unified result formatting. - **WebSocket**: WebSocket handling classes for connection management and message forwarding. - **Utils**: Utility classes, including JWT utilities, security utilities, and WebSocket utilities. - **Config**: Configuration classes, including interceptor and WebSocket configurations. - **Comment**: Common components, such as exception handling and response wrapping. - **Component**: Component classes, such as online user management. - **Enum**: Result code enumeration classes. - **Interceptor**: Interceptor classes for login validation. - **Constants**: Constant classes, such as JWT secret keys, etc. ## Features - User login and registration - Real-time communication via WebSocket - Persistent message storage - Session management - Friend list management - Unified response format and exception handling ## Technology Stack - Spring Boot - WebSocket - MyBatis Plus - JWT - Maven - MySQL (see database script `db.sql`) - Frontend: HTML/CSS/JavaScript + jQuery ## Quick Start ### Environment Preparation - JDK 1.8+ - Maven 3.0+ - MySQL 5.7+ - Node.js (for frontend asset build) ### Install Dependencies ```bash mvn install ``` ### Database Configuration Please view and import the `src/main/resources/db.sql` file to create the corresponding database tables. ### Start the Project ```bash mvn spring-boot:run ``` The project runs by default at `http://localhost:8080` ### Access Frontend Frontend pages are located in the `src/main/resources/static/` directory, including login, registration, and chat interfaces. ## Usage Instructions 1. Log in or register as a user. 2. After logging in, enter the chat interface to view session lists and send messages. 3. Supports real-time message reception via WebSocket. ## API Documentation ### User Module - `POST /user/login`: User login - `POST /user/register`: User registration - `GET /user/getUserInfo`: Get user information - `GET /user/getFriendList`: Get friend list ### Session Module - `GET /session/getSessionList`: Get session list - `POST /session/addSession`: Create a new session ### Message Module - `GET /message/getMessagesBySessionId`: Get message history by session ID ## Contributors Please follow the project's commit guidelines when submitting PRs or Issues. ## License This project is licensed under the MIT License. See the LICENSE file for details.