Skip to content

Latest commit

 

History

History
124 lines (88 loc) · 4.15 KB

README.md

File metadata and controls

124 lines (88 loc) · 4.15 KB

Join our community Follow @geneziodev

Flask-SocketIO Chat Application

A simple real-time chat application built with Flask and Socket.IO.

Features

  • Real-time messaging using WebSocket connections
  • Message history persistence during server runtime
  • Cross-origin resource sharing (CORS) enabled
  • Broadcasting messages to all connected clients

Installation

  1. Clone this repository:
git clone https://github.com/Genez-io/flask-socketio-starter
cd flask-socketio-starter
  1. Create a virtual environment:
python3 -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
  1. Install the required dependencies:
pip3 install -r requirements.txt

Running the Application

Start the server by running:

python3 app.py

The application will be available at http://localhost:5000

Project Structure

flask-socketio-starter/
├── app.py              # Main application file
├── templates/          
│   └── index.html     # Frontend template
└── README.md          # This file

API Endpoints

  • GET / - Serves the main chat interface
  • WebSocket Events:
    • request_history - Client requests message history
    • message - Send/receive chat messages
    • message_history - Receive message history from server

Usage

  1. Open the application in multiple browser windows
  2. Type messages in any window
  3. See messages appear in real-time across all connected clients
  4. Message history is preserved during server runtime

Deploy

🚀 You can deploy your own version of the template to Genezio with one click:

Deploy to Genezio

Genezio CLI Commands

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

Learn more

To learn more about Genezio, take a look at the following resources:

Contact

If you need support or you have any questions, please join us in our Discord channel. We'd love to chat!

Built With