A real-time LAN-based chat system built using Java, JSP, and WebSockets, supported by fully custom Data Structures (Linked List, Queue, Dynamic Array).
The application works on any devices connected to the same LAN / Hotspot, without needing any database or external backend.
- WebSocket-based messaging
- Automatic broadcast to all connected users
UserListβ Singly Linked ListChatHistoryArrayβ Dynamic ArrayMessageQueueβ Circular QueueUserβ Node Structure
- Dark theme
- Smooth bubble animations
- Glassmorphism login page
- Fully mobile responsive
- Chat history cached in memory
- Reloading page restores all messages
- Works between Laptop β Phone β Phone
- No router required (mobile hotspot supported)
| Component | Technology |
|---|---|
| Language | Java |
| Frontend | JSP, HTML5, CSS3, JS |
| Backend | Jakarta WebSocket API |
| Server | Apache Tomcat 10.1 |
| Data Structures | Custom Implementations |
LANChat-WebApp/
β
βββ src/
β βββ ds/
β β βββ User.java
β β βββ UserList.java
β β βββ MessageQueue.java
β β βββ ChatHistoryArray.java
β β
β βββ websocket/
β βββ ChatManager.java
β βββ ChatServerEndpoint.java
β
βββ web/
β βββ index.jsp
β βββ chat.jsp
β βββ history.jsp
β
βββ WEB-INF/
β βββ web.xml
β
βββ README.md
Stores active users connected to WebSocket.
Features:
- Add new user
- Remove disconnected user
- Search by WebSocket ID
Stores chat messages in memory.
- Resizes automatically
- Retrieved via
history.jspfor refresh-safe history
Optional queue structure for message buffering.
Follow these steps to run the chat application.
Download from:
https://tomcat.apache.org/download-10.cgi
Install to:
C:\Program Files\Apache Software Foundation\Tomcat 10.1\
Inside Tomcat:
C:\Program Files\Apache Software Foundation\Tomcat 10.1\webapps\LANChat\
Place:
index.jsp
chat.jsp
history.jsp
WEB-INF/web.xml
Also create:
WEB-INF/classes/ds
WEB-INF/classes/websocket
Open CMD inside your source folder:
cd D:\LANChatSource
Run this command:
javac -cp "C:\Program Files\Apache Software Foundation\Tomcat 10.1\lib\*;." ^
-d "C:\Program Files\Apache Software Foundation\Tomcat 10.1\webapps\LANChat\WEB-INF\classes" ^
ds\*.java websocket\*.javaThis generates:
WEB-INF/classes/ds/*.class
WEB-INF/classes/websocket/*.class
Go to:
C:\Program Files\Apache Software Foundation\Tomcat 10.1\bin\
Run:
startup.bat
If already running:
shutdown.bat
startup.bat
Laptop:
http://localhost:8080/LANChat/
Find local IP:
ipconfig
Use:
IPv4 Address . . . . : 192.168.x.x
On mobile browser:
http://192.168.x.x:8080/LANChat/
β Now mobiles and laptop can chat in real-time.
- Chat history does not disappear
- Loaded from
history.jspviaChatHistoryArray
π Security Notice
This application is intended for LAN / Local Network use only. It does not use HTTPS or authentication, so it should not be deployed on public internet without additional security layers.
MIT License β free to use and modify.
Updated by Prathemsh-Coder