A very basic chat server in Rust.
Open up your terminal, and run the following command.
cargo run
Open up another terminal, and telnet to the corresponding ip and port (default port is 1234
).
telnet 0.0.0.0 1234
cargo run -- --port=9090
NOTE: You can only join only 1 room in the entire client lifetime.
JOIN {room_name} {username}
NOTE: You'll get an error message if you attempt to send a message without joining a room.
Any random message.
All entities in the system are running as actors, and they include:
The communication between an external client(e.g. telnet) and the server adopts a very simple Codec which can ve found here.
- To handle more scale, we can leverage on actix-redis to persist user sessions to redis (possibly, a redis cluster).
If you see any area this could be improved upon, kindly feel free to open a PR. Cheers!!!.