Giter Club home page Giter Club logo

peerlink's Introduction

PeerLink

PeerLink is a distribted application for peer to peer messaging between multiple clients over a network. The system supports real-time communication among peers and also supports group semantics. A peer can join a group and automatically subscribes to all the messages in the group from the other group participants. PeerLink allows for sending messages to disconnected peers ensuring that sent messages are delivered eventually when the peer rejoins the network and message states are used to determine the status of the sent messages. Fault tolerance in PeerLink is handled through passive replication and checkpointing. On failure of the primary one of the backup servers which is up to date with the primary's state through checkpoints is promoted and the system continues to operate despite failures.

Each peer communicates through a router in order to send and receive messages, the router is used for managing metadata and acts as a mediator helping in connection management and message routing. Clients register with the server by providing a unique identifier (ID). Client registration allows the server to manage client connections and facilitate message routing and discovery.Clients can send messages directly to other clients using their unique IDs. The router routes messages between sender and recipient clients, ensuring secure and reliable communication channels. Peer-to-peer messaging allows users to exchange private messages in real-time.

The system also supports group semantics, clients can join one or more groups. Whenever a client joins a group, every client message will be broadcast to all the members of the group and at the same time the client subscribes to all the messages sent by other participants in the group. The system tracks the state of each message, including "Sent" and "Delivered". When a client sends a message, the server marks it as "Sent" and routes it to the recipients. Upon successful delivery, the server updates the message state to "Delivered", and the recipients receive notifications. Message state tracking ensures message delivery reliability and provides transparency to users about the status of their messages.

The system supports passive replication as a mechanism to deal with failures of the routing server. In case of primary server failure, a backup server takes over to maintain service continuity. Primary server failure in this system is detected through heartbeats and the state of the system is periodically saved using checkpoints and in some sense, checkpoints in the system serve as a proxy for heartbeats. This method allows seamless transition when the primary node fails ensuring one of the backup servers can take over without any data loss.

Clients

To open new clients, run following commands in separate terminals

python Client/client.py --ID peer1 --port 8000
python Client/client.py --ID peer2 --port 8001
python Client/client.py --ID peer3 --port 8002

Server

To start server and backups, run following commands in separate terminals

python Server/server.py --port 8008
python Server/server.py --port 8009 --backup
python rm.py

Steps to run code locally

Using the makefile is the easiest way to run our code

  • make build
  • make clean
  • make test

Supported commands

  • REGISTER
    • Command for registering the client with the router
  • SEND_MSG {receiver} {message_contents}
    • Command to send a message to another peer
  • CREATE_GROUP {group_name}
    • Command to greate a group, the client creating the group is automatically a member
  • JOIN_GROUP {group_name}
    • Command for a peer to join a group
  • LEAVE_GROUP {group_name}
    • command for a peer to leave a group

peerlink's People

Contributors

saagar-parikh avatar rohit-bm18 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.