|
1 |
| -# simple-chat |
2 |
| -A simple chat server challenge to build in Rust |
| 1 | +# Simple Chat |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +You have been tasked with writing a simple asynchronous chat server and CLI |
| 6 | +client. |
| 7 | + |
| 8 | +Since this is a simple chat server there is only a single room. Users may |
| 9 | +freely join or leave this room. They may also send messages to the room, which |
| 10 | +will be sent to all connected users minus the sender. |
| 11 | + |
| 12 | +Even though the server is simple, it has high throughput. Because of this, all |
| 13 | +code should be non-blocking for maximum concurrency. |
| 14 | + |
| 15 | +The following is a rough specification of the server and client. |
| 16 | + |
| 17 | +## Server |
| 18 | + |
| 19 | +* The servers job is to manage users. |
| 20 | +* It should be able to receive a message from a user and process it. |
| 21 | +* The user may wish to join, leave or send a message through the chat server. |
| 22 | +* Any other user who is currently connected should get the message sent to |
| 23 | +them. |
| 24 | +* The user who sent the message should not get the message. |
| 25 | +* When a user sends a leave message, or disconnects their client, the server |
| 26 | +should no longer send messages to them, and do any internal bookkeeping to |
| 27 | +clean up. |
| 28 | +* Username's should be unique. |
| 29 | +* The server should be able to support many users without a large delay |
| 30 | +* The server should be able to support many users with a small memory footprint |
| 31 | + |
| 32 | + |
| 33 | +## Client |
| 34 | + |
| 35 | +* The client is an async CLI program. |
| 36 | +* It is responsible for sending messages to the server and displaying any |
| 37 | +messages from the server. |
| 38 | +* The client should accept environment variables or command line arguments |
| 39 | +indicating the host and port where the server is listening. It should also |
| 40 | +accept a username that will be used as an identifier on the server. |
| 41 | +* The client should automatically connect to the chat server upon |
| 42 | +initialization using the specified host and port. |
| 43 | +* The client should display an interactive command prompt. The prompt should |
| 44 | +be able to handle the following inputs: |
| 45 | + * `send <MSG>` where `<MSG>` is the message that should be sent to the |
| 46 | + server |
| 47 | + * `leave` this will disconnect the client from the server and exit the CLI. |
| 48 | + |
| 49 | + |
| 50 | +## Additional Requirements |
| 51 | + |
| 52 | +* Your source should contain both unit and integration tests where necessary. |
| 53 | +* All code must be formatted using the standard formatting tool. |
| 54 | +* Code must compile without clippy errors. |
| 55 | + |
| 56 | +## Submission |
| 57 | + |
| 58 | +Please fork this repository to your own GitHub account and submit a pull |
| 59 | +request to your own repository. Your pull request should include a |
| 60 | +video of a working demo at the top along with any other key information |
| 61 | +that should be highlighted. A link to the pull request can be submitted when |
| 62 | +it is ready for review. |
| 63 | + |
| 64 | +## Bonus |
| 65 | + |
| 66 | +* Include a rusty-hook that will ensure that all code is formatted, compiles |
| 67 | +without error, and is free of clippy errors. |
| 68 | +* Create a GitHub Action that will launch your chat server and attempt to |
| 69 | +send a message to the server from the client. Make sure that niether the server |
| 70 | +or client exit with a failure. This action should be run anytime new code |
| 71 | +is pushed to a branch or landed on the main branch. |
0 commit comments