This application has a single global room where all connected "users" can send and receive messages.
You can build a web-based frontend using the Websockets API. The message is basically a JSON object with the following form:
{
"nickname": "Joe Doe",
"message": "A message"
}
NOTE: It does not echo the sender's message.
I've included a test CLI program called testchat.py
. Its usage is pretty
straightforward: you just have to provide a nickname and then a message. After
that it waits for other users' messages to arrive. Once the messages are
received, the prompt to send a new message is presented once again. Looping
endlessly.
To run the server you just need docker (docker compose) installed in your machine and the run the following command:
docker-compose -f docker-compose.yml up
In this case you have to first make sure you have Python and Poetry installed in your system.
I will not give you details on how to install Python in your system, for that you can go to https://www.python.org.
To install poetry, just run the following command:
pip install -U poetry
Then, install all the test script dependencies, just so:
poetry install
After that you're good to run the test script!
poetry run ./testchat.py