Turbo-Flask but using Flask-SSE
Go to file
Sam Black a44dc22a94
Close stream source element
2023-09-09 15:38:49 +01:00
tests Initial commit 2022-09-20 16:08:06 +01:00
turbo_flask_sse Close stream source element 2023-09-09 15:38:49 +01:00
.gitignore Update git ignore 2023-09-09 15:02:24 +01:00
LICENCE Include licence information for Turbo-Flask and flesh out readme 2022-09-23 20:18:51 +01:00
README.rst Add builtin Flask-SSE, removing six requirement 2023-09-08 11:29:29 +01:00
poetry.lock Bump python dep versions 2023-08-17 16:29:01 +01:00
pyproject.toml Add dev settings and packages 2023-09-08 11:33:26 +01:00

README.rst

===============
Turbo-Flask-SSE
===============

About
=====

Use Turbo-Flask with Flask-SSE instead of Websockets.

Uses `Turbo-Flask <https://github.com/miguelgrinberg/turbo-flask>`_ from Miguel Grinberg as a basis
and utilises `Flask-SSE <https://github.com/singingwolfboy/flask-sse>`_ from David Baumgold.


Requirements
============

- Python >= 3.9, tested with 3.10
- poetry
- Redis


Running
=======

Turbo-Flask-SSE requires using `gunicorn` the same as Flask-SSE, for example;

.. code::

    gunicorn wsgi:app --reload --worker-class gevent --bind 0.0.0.0:8000


Usage
=====

Turbo-Flask-SSE has the same interface as Turbo-Flask.

There are some additions;

- `TURBO_SSE_ROUTE` for the SSE route, defaults to `/turbo-sse`
- `TURBO_SSE_FLASH_TEMPLATE` for the template path to show `flash`ed messages, defaults to disabled
- `TURBO_SSE_FLASH_TARGET` for the ID of the HTML element for the `flash`ed messages to update
- `turbo_head`/`turbo_body` for including Turbo JS version 7.2 or later
- `auth_func` decorator to enforce authorisation checks on SSE requests,
  for example to check if the user requesting the channel is authorised to do so


Licence
=======

Turbo-Flask-SSE is Copyright (C) 2022-2023 Sam Black <samwwwblack@lapwing.org>.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this program.
If not, see `https://www.gnu.org/licenses/ <https://www.gnu.org/licenses/>`_.


Turbo-Flask is Copyright (c) 2021 Miguel Grinberg and
released under the MIT License (MIT).

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Flask-SSE is Copyright (c) 2016-2021 David Baumgold and
released unde the MIT License (MIT).

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.