How huagoufdog/fdoginstantmessaging works
• A desktop client (FdogClient) built with Qt (using C++ and the Qt framework) that handles login, friend management, chat interfaces, and various UI components.
• A desktop/server component (FdogServer) also built with Qt, which manages connections, message routing, and other backend processing for the desktop client.
• A web front-end (FdogWeb) implemented with Java (using a Maven project) that handles account registration, web-based interactions, and possibly other web services (all deployed via Tomcat).
Additionally, there is a database schema file (FdogSql/fdogsql.sql) along with user SQL management code (usersql.cpp/h present in both client and server), indicating the use of MySQL as the backend database.
Main Components
a. Desktop Client (FdogClient):
– Qt-based event handling and UI management.
– Modules that communicate with the server (e.g., addfriend, chat, verify).
b. Desktop Server (FdogServer):
– Message routing and event handling.
– Database interaction via shared user SQL classes.
– Handling client connection states and dispatching messages.
c. Web Application (FdogWeb):
– Java-based backend (Maven project) handling account registration and authentication.
– Frontend components (HTML, CSS, JavaScript) for web UI.
– Integration with MySQL via JDBC (as indicated by the MySQL connector jar).
d. Database (FdogSql):
– MySQL database storing user information, chat history, and friend relationships.
– Serves as the central data store for both desktop and web applications.
e. External Services:
– Tencent Cloud SMS service for sending verification codes.
– Potential integration with third-party notification services.
Relationships and Interactions
– Desktop Client sends login requests, chat messages, and friend management commands to the Desktop Server.
– Desktop Server handles these requests and interacts with the MySQL database (using Usersql classes) to retrieve or update persistent data.
– Web Application serves account registration and account management functions, communicating with the same or a parallel MySQL database.
– Both client and web components may use external services (e.g., Tencent Cloud SMS) to verify phone numbers or send alerts.
Architectural Patterns and Design Principles
– Separation of concerns: clear division between the UI layer (client and web UI), business logic (server, Java backend), and persistent data layer (MySQL).
– Client-server communication: indicate network sockets/HTTP API endpoints connecting the client and server.
– Modular design: note the “friend management”, “chat”, “login”, and “tray widget” components on the client side separately.
– Singleton patterns are used in managing some shared resources (e.g., optimization in Usersql class as mentioned in the README).
Relevant Technologies, Frameworks, or Libraries
– Qt5.10 for the desktop client and server.
– C++ for client/server code with Qt Designer files (e.g., .ui, .h, .cpp files).
– Java Maven project for the web application, with Tomcat deployment and use of MySQL Connector/J.
– HTML/CSS/JavaScript assets in the web project.
– MySQL for database management.
– External APIs (Tencent Cloud for SMS).