A simple real-time chat application built with Flask and Socket.IO.
- Real-time messaging using WebSocket connections
- Message history persistence during server runtime
- Cross-origin resource sharing (CORS) enabled
- Broadcasting messages to all connected clients
- Clone this repository:
git clone https://github.com/Genez-io/flask-socketio-starter
cd flask-socketio-starter
- Create a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install the required dependencies:
pip3 install -r requirements.txt
Start the server by running:
python3 app.py
The application will be available at http://localhost:5000
flask-socketio-starter/
├── app.py # Main application file
├── templates/
│ └── index.html # Frontend template
└── README.md # This file
GET /
- Serves the main chat interface- WebSocket Events:
request_history
- Client requests message historymessage
- Send/receive chat messagesmessage_history
- Receive message history from server
- Open the application in multiple browser windows
- Type messages in any window
- See messages appear in real-time across all connected clients
- Message history is preserved during server runtime
🚀 You can deploy your own version of the template to Genezio with one click:
Genezio also provides a CLI tool that you can use to deploy your project from your machine. All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
npm install -g genezio |
Installs genezio globally |
genezio login |
Logs in to genezio |
genezio local |
Starts a local server |
genezio deploy |
Deploys a production project |
genezio --help |
Get help using genezio |
To learn more about Genezio, take a look at the following resources:
If you need support or you have any questions, please join us in our Discord channel. We'd love to chat!