https://github.com/githubjakob/flask-socket-chat-demo
Demo application to create a chat using flask and socketio
https://github.com/githubjakob/flask-socket-chat-demo
Last synced: 9 months ago
JSON representation
Demo application to create a chat using flask and socketio
- Host: GitHub
- URL: https://github.com/githubjakob/flask-socket-chat-demo
- Owner: githubjakob
- Created: 2023-03-25T22:11:53.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-11T07:53:11.000Z (about 3 years ago)
- Last Synced: 2025-02-16T20:28:23.929Z (over 1 year ago)
- Language: HTML
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flask-SocketIO-Supervisord Example Application
This is a simple example application of a chat using Flask and Flask-SocketIO.
It consists of:
- A Flask application using Flask-SocketIO that handles the Websocket connections
(running with gunicorn and an eventlet worker)
- A Flask application that contains the REST interface for the chat
(running with gunicorn and normal sync workers)
- Redis for handling the inter process communication between the two Flask applications
- A nginx reverse proxy in front of the two Flask applications
- Supervisord for running everything in a Docker container
- Docker compose that runs the Docker container with the example application and a Redis container
- Python AsyncIO clients for load testing
## Motivation
Flask-SocketIO recommends either using eventlet or gevent as the worker type for the gunicorn web server.
However, an existing Flask application might already run using the regular sync gunicorn workers. Assuming we don't
want to change the setup for the existing Flask application we can run the Flask-SocketIO application in a separate
process. In this case a Redis server can be used to handle the inter process communication between the two Flask applications.
## Miro Board
https://miro.com/app/board/uXjVMUlDu70=/
## TODO
- Extend the clients for load testing
- Add a database for storing the chat messages
- Goal: Run everything in AWS Elastic Beanstalk