High performant chat server to skill up in Rust and Tokio.
- Each incoming request spins up a tokio task => the server can handle multiple requests at the time.
- The conversation history is the only mutable shared state between the tokio tasks.
- So i chose to store it on the heap and protected it with a reference-counting pointer and a mutex (
Arc<Mutex<Vec<(String, String)>>>
). - I may do the message passing between tokio tasks option in the future.
- So i chose to store it on the heap and protected it with a reference-counting pointer and a mutex (
- Shortcomings:
- The client only communicates to the backend through GET requests.
- You have to constantly renter your username.
- It is now containerized, with a clean multi-staged build for quick developement.
- To run: just run
docker-compose up --build
I know the html sucks, but the focus was on the backend.