Giter VIP home page Giter VIP logo

chat-server-project's Introduction

Async Chat Server Project

This project is a chat server implementation using Rust programming language, PostgreSQL database, and a broker pattern. The code is implemented based on the idea of a broker from the Async Programming in Rust book.

Team

This project is a collaborative effort and we would like to acknowledge the contributions of:

We appreciate their hard work and dedication in making this project a success.

Features

  • Allows multiple clients to connect and communicate with each other in real-time.
  • Uses a broker pattern to handle message distribution between clients.
  • Messages sent by both the sender and receiver are saved in a PostgreSQL database for future reference.
  • The broker is responsible for receiving and processing events from various components within the system.
  • The broker maintains a HashMap named peers that keeps track of connected clients.
  • The broker handles events related to inserting messages into a database.
  • The broker manages client disconnections.
  • The broker_loop function runs in its own asynchronous task, continuously processing events in the background.

Prerequisites

Before running the chat server, make sure you have the following installed:

Setup

  1. Clone the repository:

    git clone https://github.com/YasoKarim/Chat_Server.git
  2. Navigate to the project directory:

    cd Chat-Server-Project
  3. Install the required dependencies:

    cargo build
  4. Set up the PostgreSQL database:

    • Create a new database in PostgreSQL for the chat server.
    • Update the database connection details in the configuration file (config.toml) with your PostgreSQL credentials.
  5. Run the chat server:

    cargo run

Usage

  • Clients can connect to the chat server using a WebSocket client.
  • Messages sent by clients will be distributed to all connected clients using the broker pattern.
  • All messages sent by clients will be saved in the PostgreSQL database for future reference.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

Note

The server and the client are made in different projects using cargo new (proj_name) then cargo build. On running the code you write cargo run for the server first then the client.

chat-server-project's People

Contributors

yasokarim 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.