Skip to content

Prathemsh-Coder/LANChat-WebApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 LAN Chat Room – JSP + WebSocket + Custom Data Structures

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.


πŸš€ Features

πŸ”₯ Real-Time Communication

  • WebSocket-based messaging
  • Automatic broadcast to all connected users

🧠 Custom Data Structures

  • UserList β†’ Singly Linked List
  • ChatHistoryArray β†’ Dynamic Array
  • MessageQueue β†’ Circular Queue
  • User β†’ Node Structure

🎨 Modern UI

  • Dark theme
  • Smooth bubble animations
  • Glassmorphism login page
  • Fully mobile responsive

πŸ’Ύ Refresh-Safe Chat History

  • Chat history cached in memory
  • Reloading page restores all messages

πŸ“± LAN / Hotspot Support

  • Works between Laptop ↔ Phone ↔ Phone
  • No router required (mobile hotspot supported)

πŸ› οΈ Tech Stack

Component Technology
Language Java
Frontend JSP, HTML5, CSS3, JS
Backend Jakarta WebSocket API
Server Apache Tomcat 10.1
Data Structures Custom Implementations

πŸ“ Project Structure (GitHub Version)

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

🧱 Custom Data Structures Overview

1️⃣ UserList – Linked List

Stores active users connected to WebSocket.

Features:

  • Add new user
  • Remove disconnected user
  • Search by WebSocket ID

2️⃣ ChatHistoryArray – Dynamic Array

Stores chat messages in memory.

  • Resizes automatically
  • Retrieved via history.jsp for refresh-safe history

3️⃣ MessageQueue – Circular Queue

Optional queue structure for message buffering.


βš™οΈ Setup / Installation Guide

Follow these steps to run the chat application.


🟦 STEP 1 β€” Install Tomcat 10.1

Download from:
https://tomcat.apache.org/download-10.cgi

Install to:

C:\Program Files\Apache Software Foundation\Tomcat 10.1\

🟩 STEP 2 β€” Create Deployment Folder

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


🟧 STEP 3 β€” Compile Java Source Files Into Tomcat

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\*.java

This generates:

WEB-INF/classes/ds/*.class
WEB-INF/classes/websocket/*.class

🟨 STEP 4 β€” Start Tomcat

Go to:

C:\Program Files\Apache Software Foundation\Tomcat 10.1\bin\

Run:

startup.bat

If already running:

shutdown.bat
startup.bat

🟫 STEP 5 β€” Open in Browser

Laptop:

http://localhost:8080/LANChat/

πŸŸͺ STEP 6 β€” Connect from Mobile (LAN / Hotspot)

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.


πŸ”„ Refresh Behavior

  • Chat history does not disappear
  • Loaded from history.jsp via ChatHistoryArray

πŸ” 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.


πŸ“ License

MIT License β€” free to use and modify.


Updated by Prathemsh-Coder

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages