Loading repository data…
Loading repository data…
DangHuuLong / repository
A JavaFX desktop social chat application built on a custom TCP socket protocol, featuring real-time messaging, file transfer, group chat, LAN voice/video calling, and AI-powered smart reply suggestions.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A JavaFX desktop social chat application built on a custom TCP socket protocol, with real-time messaging, file transfer, group chat, LAN voice/video calling, and AI-powered smart reply suggestions.
📦 Repository: github.com/DangHuuLong/Social-Chat-App
Social Chat App is a Java desktop application implementing a full client-server chat platform. The client and server communicate over TCP sockets using a custom binary frame protocol. The application is built with JavaFX for the UI, MySQL for persistence, and supports a broad set of messaging, file sharing, group chat, and calling features.
The project is structured as a single repository containing the client, server, and a shared common layer used by both sides.
Frame and FrameIOhttp://localhost:8000/smart-reply| Layer | Technology |
|---|---|
| Language | Java |
| UI Framework | JavaFX + FXML |
| UI Styling | CSS (light & dark theme support) |
| Networking | TCP Sockets — custom Frame / FrameIO protocol |
| Database | MySQL (socialchatapp database) |
| Security | BCrypt password hashing |
| Media Playback | JavaFX Media APIs + InMemoryMediaServer (local HTTP) |
| Calling | LanAudioSession (PCM), LanVideoSession (JPEG over socket) |
| Smart Reply | Local FastAPI endpoint (http://localhost:8000/smart-reply) |
The repository is organized into three main layers:
┌─────────────────────────────────────────┐
│ JavaFX Client │
│ (UI Controllers · ClientConnection) │
└─────────────────┬───────────────────────┘
│ TCP · Custom Frame Protocol
│ Port 5000
▼
┌─────────────────────────────────────────┐
│ Java Socket Server │
│ (ClientHandler · DAOs · CallRouter) │
└──────────┬──────────────────────────────┘
│ │
▼ ▼
MySQL FastAPI
(socialchatapp) (Smart Reply · :8000)
Frame, FrameIO, MessageType, Message, User, etc.)Social-Chat-App/
├── src/
│ ├── client/
│ │ ├── ClientMain.java # Client entry point
│ │ ├── ClientConnection.java # Socket/network gateway
│ │ └── controller/
│ │ ├── MainController.java # Login/register flow
│ │ ├── HomeController.java # Main screen coordinator
│ │ ├── LeftController.java # Sidebar, user list, presence
│ │ ├── MidController.java # Chat area, messages, file/call state
│ │ ├── RightController.java # Media/document panel, preview
│ │ └── handler/
│ │ ├── CallHandler.java
│ │ ├── FileHandler.java
│ │ ├── MediaHandler.java
│ │ ├── MessageHandler.java
│ │ ├── SearchHandler.java
│ │ ├── SessionHandler.java
│ │ ├── UIMessageHandler.java
│ │ └── VoiceRecordHandler.java
│ │
│ ├── server/
│ │ ├── ServerMain.java # Server entry point (port 5000)
│ │ ├── ClientHandler.java # Per-client frame handler
│ │ ├── CallRouter.java # Call signaling routing
│ │ ├── MessageService.java # Message/file deletion workflow
│ │ └── dao/
│ │ ├── UserDAO.java
│ │ ├── MessageDAO.java
│ │ ├── FileDAO.java
│ │ ├── GroupDAO.java
│ │ └── GroupMessageDAO.java
│ │
│ └── common/
│ ├── Frame.java # Custom binary frame
│ ├── FrameIO.java # Frame read/write
│ ├── MessageType.java # Protocol message types
│ ├── Message.java
│ ├── GroupMessage.java
│ ├── Group.java
│ ├── User.java
│ └── FileResource.java
│
├── resources/
│ ├── Main.fxml
│ ├── Home.fxml
│ ├── VideoCall.fxml
│ └── *.css # UI stylesheets (light/dark theme)
│
├── uploads/ # Server-side file storage
├── temp/ # Temporary working files
├── bin/ # Compiled output
├── build.fxbuild
├── .classpath
├── .project
└── README.md
The client connects to the server at 127.0.0.1:5000 via ClientConnection. After authentication, the HomeController initializes three sub-controllers: LeftController (sidebar and user list), MidController (chat area and message logic), and RightController (media/info panel). Specialized handlers under the controller layer manage calls, file transfers, voice recording, media playback, search, and session management.
ServerMain opens a TCP server socket on port 5000 and spawns a ClientHandler thread for each connected client. The server handles message routing, offline queuing, file storage/retrieval, group management, and call signaling delegation via CallRouter. DAO classes manage all MySQL interactions. MessageService handles deletion workflows.
Both sides share the common package. Frame is the base unit of communication, and FrameIO handles serialization and deserialization. MessageType defines all protocol operations. Shared model classes (User, Message, GroupMessage, Group, FileResource) ensure type consistency across the client-server boundary.
Client A types message
└─► MidController → MessageHandler
└─► ClientConnection → Frame(SEND_MESSAGE) → Server
└─► ClientHandler → MessageDAO (persist)
└─► Frame(RECEIVE_MESSAGE) → Client B (if online)
└─► Queue (if Client B offline → deliver on reconnect)
http://localhost:8000/smart-reply and forwards suggestions to the recipient if the request succeeds.Client A selects file
└─► FileHandler → FILE_META frame (filename, size, type)
└─► FILE_CHUNK frames × N (64 KB each, max 25 MB)
└─► Server stores file → notifies Client B
└─► Client B downloads on demand
InMemoryMediaServer exposes in-memory audio/video as local HTTP URLs to support JavaFX's media player.Frame-based flow, routed to all active members by the server.Caller sends CALL_INVITE frame
└─► Server (CallRouter) → forwards to Callee
├─► Callee accepts → CALL_ACCEPT → LAN media session opens
├─► Callee rejects → CALL_REJECT
├─► Callee busy → CALL_BUSY
└─► Caller cancels → CALL_CANCEL
During call:
LanAudioSession — PCM audio streamed over direct socket
LanVideoSession — JPEG frames from webcam streamed over direct socket
Toggle mic / camera supported
Dedicated VideoCall.fxml window with local + remote views
Either party sends CALL_END → session closes
⚠️ The calling implementation is LAN-oriented. It relies on direct socket connections between peers and is not designed for NAT traversal or internet-grade calling.
socialchatapp