Skip to content

Rohith-Kanathur/ChatServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Client-to-Client Chat Server

This project implements a multi-client chat server that supports end-to-end communication between any two clients using WebSockets. It enables users to log in, send direct messages, broadcast messages to all connected users, and manage sessions in real time.


🚀 Project Overview

The Client-to-Client Chat Server facilitates real-time communication between multiple clients through a central Tomcat server. The server manages authentication, session tracking, and message routing using efficient in-memory data structures.

Users can:

  • Log in securely via authentication implemented using Servlets.
  • View a list of online users in real time.
  • Send private messages to any connected user.
  • Broadcast messages to all users currently online.
  • Log out, which automatically updates the list of active users.

⚙️ Design and Implementation

1. Authentication

  • Implemented using Java Servlets.
  • On successful login, the user ID is stored in the browser cache for session persistence.
  • Server maintains an active users list with session details in a HashMap, updated on login/logout events.

2. Messaging

  • A client selects a recipient user ID and sends a message.
  • The server retrieves the recipient’s session using the HashMap and delivers the message directly.
  • A broadcasting feature allows a message to be sent to all connected users simultaneously.

3. Testing

Tested for:

  • Login and logout functionality
  • One-to-one message delivery
  • Broadcasting messages
  • Session updates on user connect/disconnect events

🛠️ Environment, Tools & Technologies

Component Details
Language Java
Frameworks/Tech Servlets, WebSockets
Frontend HTML, CSS, JavaScript
Server Apache Tomcat v10.0
IDE Eclipse (Version 2022-03)

About

Chat server using web sockets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors