Skip to content

pedromiguelmiranda/another-rust-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


Another rust chat

TCP socket based chat built in Rust programming language
Explore the docs »

View Demo · Report Bug · Request Feature

Product Name Screen Shot

I built this chat to improve my skills on Rust programming language. feel free to use it.

The server listens on 127.0.0.1:8080.

Each connected client is handled in a separate thread.

The clients vector contains all connected clients' streams and is wrapped in an Arc<Mutex<>> for thread safety. When a message is received from a client, it's broadcasted to all other connected clients.

When a client disconnects, its stream is removed from the clients vector.

Remember, this is still a simple example and doesn't handle all edge cases, such as errors during read/write operations or handling disconnected clients gracefully. In production-level code, you'd want to add more error handling and robustness features.

(back to top)

Built With

Rust

(back to top)

Getting Started

Prerequisites

Rust toolkit installed. please refer to Rust documentation

Installation

build and run

$ cargo build

If you want to execute locally in your network on several computers you might need to allow the used port on your local firewall.

(back to top)

Usage

  • start the server (inside chat-server folder)
$ cargo run
  • start the chat clients (inside chat-client folder)
$ cargo run

(back to top)

Roadmap

  • [ v ] basic server and client
  • Change server concurrency pattern
  • Add prompt to client
  • create client dedicated structures

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Project Link: https://github.com/pedromiguelmiranda/another-rust-chat

(back to top)