Skip to content

This project is a decentralized peer-to-peer (P2P) chat application built with Python, featuring **Fernet encryption** for secure messaging, **logical clocks** for maintaining message order, and a lightweight signaling server for peer discovery, ensuring reliable and fault-tolerant communication without a central server.

Notifications You must be signed in to change notification settings

sauryakrgupta/P2P-Chat-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Ā 

History

24 Commits
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 

Repository files navigation

P2P Chat Application

A decentralized peer-to-peer (P2P) chat application built with Python that enables secure, real-time messaging without relying on centralized servers. The system is designed for scalability, resilience, and privacy, ensuring robust communication across distributed networks.

Features

  • Decentralized Architecture: Eliminates single points of failure with peer-to-peer communication using UDP sockets.

  • Secure Messaging: Ensures confidentiality with Fernet symmetric encryption for end-to-end secure chats.

  • Causal Message Ordering: Maintains the correct sequence of events using logical clocks.

  • Dynamic Peer Management: Supports seamless peer discovery and failure detection using a lightweight signaling server.

  • Data Replication: Preserves chat history across nodes for availability during node failures.

  • Multithreading: Handles concurrent operations like message queuing, peer status monitoring, and data replication efficiently.

Prerequisites

Python 3.6 or higher cryptography library

Install dependencies:pip install cryptography

Running the Application

Start the signaling server:python signaling_server.py

Run a chat node: python main.py --host localhost --port 5000 --username Alice

General Commands

  1. Show Help: /help
  • Display a list of all available commands.
  1. Exit Application: /quit
  • Quit the current chat node session.

Chat Room Management

  1. Create a Chat Room: /create_chat <Chat Name>
  • Create a new chat room and get a unique Chat ID.
  1. Join an Existing Chat Room: /join_chat <Chat ID>
  • Join a chat room using the Chat ID provided.

Messaging

  1. Send a Message: /send_chat <Chat Name> <Message>
  • Send a message to a specific chat room.

Peer Management

  1. List Connected Peers: /peers
  • View all connected peers in your chat room.

These commands enable seamless interaction with the P2P chat application, covering room management, messaging, and peer connectivity.

🌐 Technologies Used

  1. Python 3.6+
  2. UDP Sockets
  3. Fernet Encryption
  4. Logical Clocks for event ordering
  5. Multithreading for concurrent tasks

ā€¼ļøContributing

Feel free to fork, clone, and contribute to this project. Suggestions for improvements or additional features are always welcome.

About

This project is a decentralized peer-to-peer (P2P) chat application built with Python, featuring **Fernet encryption** for secure messaging, **logical clocks** for maintaining message order, and a lightweight signaling server for peer discovery, ensuring reliable and fault-tolerant communication without a central server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages