skip to navigation
skip to content

Flask-SSE 0.2.1

Server-Sent Events for Flask

A Flask extension for HTML5 server-sent events support, powered by Redis.

Example of sending events:

from flask import Flask
from flask_sse import sse

app = Flask(__name__)
app.config["REDIS_URL"] = "redis://localhost"
app.register_blueprint(sse, url_prefix='/stream')

def send_message():
    sse.publish({"message": "Hello!"}, type='greeting')
    return "Message sent!"

To receive events on a webpage, use Javascript to connect to the event stream, like this:

var source = new EventSource("{{ url_for('') }}");
source.addEventListener('greeting', function(event) {
    var data = JSON.parse(;
    // do what you want with this data
}, false);

The full documentation for this project is hosted on ReadTheDocs.

File Type Py Version Uploaded on Size
Flask-SSE-0.2.1.tar.gz (md5) Source 2016-04-15 471KB
Flask_SSE-0.2.1-py2.7.egg (md5) Python Egg 2.7 2016-04-15 7KB
Flask_SSE-0.2.1-py2.py3-none-any.whl (md5) Python Wheel 2.7 2016-04-15 5KB