CHAPTER 4
API
class flask_sse.Message(data, type=None, id=None, retry=None)
Data that is published as a server-sent event.
__init__(data, type=None, id=None, retry=None)
Create a server-sent event.
Parameters
• data – The event data. If it is not a string, it will be serialized to JSON using the Flask
application’s JSONEncoder.
• type – An optional event type.
• id – An optional event ID.
• retry – An optional integer, to specify the reconnect time for disconnected clients of this
stream.
__str__()
Serialize this object to a string, according to the server-sent events specification.
to_dict()
Serialize this object to a minimal dictionary, for storing in Redis.
class flask_sse.ServerSentEventsBlueprint(name: str, import_name: str, static_folder:
Optional[str] = None, static_url_path: Op-
tional[str] = None, template_folder: Op-
tional[str] = None, url_prefix: Optional[str]
= None, subdomain: Optional[str] = None,
url_defaults: Optional[dict] = None, root_path:
Optional[str] = None, cli_group: Optional[str]
= <object object>)
A flask.Blueprint subclass that knows how to publish, subscribe to, and stream server-sent events.
messages(channel=’sse’)
A generator of Message objects from the given channel.
9