Designing chat application - Send message to other connected client (Rust backend)

To practice my Rust skills I want to build a chat application. Before doing so, I searched google on "chat application rust github" and I get a few examples, but they are all not maintained. I am not sure how to send messages between clients that are currently connected to my server.

All chatters are connected through a websocket ( I am already using redis ( for caching geo locations, so maybe a pub/sub could work? I could also add all my connected persons into a hashmap or something and than do a lookup, but I doubt that is a scalable solution. I see that Actix also have chat examples out there, but before learning and exploring another crate, I want to make sure it fits my needs:

  • can handle lots of users without exploding RAM
  • does not create a connection to some database for each and every user (I think that is what redis is doing in the rust crate for creating a pub/sub connection)
  • should be decent fast (it does not have to be blazing fast, but please no locking on every message send on e.g. a hashmap of users)
  • abstractions like rabbitMQ are ok, I like to learn if it can do what I want -it would be nice to be able to send a message to multiple users (group messaging)

Does anyone has experience with the same requirements?

Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown 路 Publish articles on custom domain 路 Gain readership on day zero 路 Automatic GitHub backup and more

No Comments Yet