A client-server messenger built with Flask.
It uses WebSocket API
(flask-socketio for the server, socket.io for the client, gevent as a transport)
and features a tiny REST API.
PostgreSQL is the default RDBMS.
Email sending is implemented using Celery with Redis as a message broker.
The web interface looks okay in Firefox 78.0.2, not so much in Chromium 84.0.4147.89.
Other browsers have not been tested.
Screenshots
After registration, the user is automatically logged in but stays unconfirmed - they have to check the inbox and follow the provided link
Main page, several users selected
Main page, users and chats are filtered
Main page, users and chats filtered, no chats found
Installation
The easiest way to run the app is to create a Docker image and then run it in a container.
If you have a Debian based system (Ubuntu, Mint...), the following steps should work
(tested on Ubuntu 20.04 LTS with docker.io 19.03.8 installed):
- clone the repository, navigate to the project directory and make
install.shexecutable
$ git clone https://github.com/96tm/simple-messenger.git; cd simple-messenger; chmod +x install.sh- run the installation script
(replaceMAIL_SERVERwith an email server of your choice,
EMAIL_ADDRESSwith an account address on that server,
EMAIL_PASSWORDwith the account's password;
MAIL_PORTis optional and equals587by default):
$ sudo ./install.sh "MAIL_SERVER" "EMAIL_ADDRESS" "EMAIL_PASSWORD" "MAIL_PORT"Now you can open the app at localhost:8888/auth/signup and register.
Or you can log in right away with one of the test email/password pairs:
- email
[email protected], passwordarthurarthur; - email
[email protected], passwordmorgainmorgain; - email
[email protected], passwordmerlinmerlin.
To uninstall the application, run the following:
$ chmod +x uninstall.sh; sudo ./uninstall.shTo remove the images:
$ sudo docker image rm python:3.7-alpine
$ sudo docker image rm redis
$ sudo docker image rm postgresREST API
The following actions are available:
- get a list of the authenticated user's chats
/api/v1.0/chats; - get a chat by id
/api/v1.0/chats/1; - get a list of messages in the chat
/api/v1.0/chats/1/messages; - get a message by the id from the chat
/api/v1.0/chats/1/messages/1; - send a message
/api/v1.0/chats/1/messages/.
Sending a message requires a JSON object in the form
{"text" :"your_message_text"}
in the request.








