All Projects → aio-libs → Aiohttp Sse

aio-libs / Aiohttp Sse

Licence: other
Server-sent events support for aiohttp

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Aiohttp Sse

Rocketgram
Modern and powerful asynchronous telegram bot framework.
Stars: ✭ 37 (-70.4%)
Mutual labels:  asyncio, aiohttp
Raven Aiohttp
An aiohttp transport for raven-python
Stars: ✭ 92 (-26.4%)
Mutual labels:  asyncio, aiohttp
Jquery Sse
jQuery Plugin for Server-Sent Events (SSE) EventSource Polyfill
Stars: ✭ 37 (-70.4%)
Mutual labels:  eventsource, server-sent-events
Aioslacker
slacker wrapper for asyncio
Stars: ✭ 23 (-81.6%)
Mutual labels:  asyncio, aiohttp
Aioauth
Asynchronous OAuth 2.0 framework and provider for Python 3
Stars: ✭ 102 (-18.4%)
Mutual labels:  asyncio, aiohttp
V3n0m Scanner
Popular Pentesting scanner in Python3.6 for SQLi/XSS/LFI/RFI and other Vulns
Stars: ✭ 847 (+577.6%)
Mutual labels:  asyncio, aiohttp
Python Dependency Injector
Dependency injection framework for Python
Stars: ✭ 1,203 (+862.4%)
Mutual labels:  asyncio, aiohttp
Aiohttp Demos
Demos for aiohttp project
Stars: ✭ 517 (+313.6%)
Mutual labels:  asyncio, aiohttp
Ruia
Async Python 3.6+ web scraping micro-framework based on asyncio
Stars: ✭ 1,366 (+992.8%)
Mutual labels:  asyncio, aiohttp
Eventsource
The Hoa\Eventsource library.
Stars: ✭ 99 (-20.8%)
Mutual labels:  eventsource, server-sent-events
Aiomixcloud
Mixcloud API wrapper for Python and Async IO
Stars: ✭ 23 (-81.6%)
Mutual labels:  asyncio, aiohttp
Sockjs
SockJS Server
Stars: ✭ 105 (-16%)
Mutual labels:  asyncio, aiohttp
Aiobotocore
asyncio support for botocore library using aiohttp
Stars: ✭ 630 (+404%)
Mutual labels:  asyncio, aiohttp
Heroku Aiohttp Web
A project starter template for deploying an aiohttp app to Heroku
Stars: ✭ 14 (-88.8%)
Mutual labels:  asyncio, aiohttp
Eventsource
EventSource client for Node.js and Browser (polyfill)
Stars: ✭ 541 (+332.8%)
Mutual labels:  eventsource, server-sent-events
Pyfailsafe
Simple failure handling. Failsafe implementation in Python
Stars: ✭ 70 (-44%)
Mutual labels:  asyncio, aiohttp
Sanic Ms
基于sanic的微服务基础架构
Stars: ✭ 336 (+168.8%)
Mutual labels:  asyncio, aiohttp
Aiojobs
Jobs scheduler for managing background task (asyncio)
Stars: ✭ 492 (+293.6%)
Mutual labels:  asyncio, aiohttp
Rororo
Implement aiohttp.web OpenAPI 3 server applications with schema first approach.
Stars: ✭ 95 (-24%)
Mutual labels:  asyncio, aiohttp
Demo Spring Sse
'Server-Sent Events (SSE) in Spring 5 with Web MVC and Web Flux' article and source code.
Stars: ✭ 102 (-18.4%)
Mutual labels:  eventsource, server-sent-events

aiohttp-sse

.. image:: https://travis-ci.org/aio-libs/aiohttp-sse.svg?branch=master :target: https://travis-ci.org/aio-libs/aiohttp-sse

.. image:: https://codecov.io/gh/aio-libs/aiohttp-sse/branch/master/graph/badge.svg :target: https://codecov.io/gh/aio-libs/aiohttp-sse

.. image:: https://pyup.io/repos/github/aio-libs/aiohttp-sse/shield.svg :target: https://pyup.io/repos/github/aio-libs/aiohttp-sse/ :alt: Updates

.. image:: https://badges.gitter.im/Join%20Chat.svg :target: https://gitter.im/aio-libs/Lobby :alt: Chat on Gitter

The EventSource* interface is used to receive server-sent events. It connects to a server over HTTP and receives events in text/event-stream format without closing the connection. aiohttp-sse provides support for server-sent events for aiohttp_.

Installation

Installation process as simple as::

$ pip install aiohttp-sse

Mailing List

aio-libs google group: https://groups.google.com/forum/#!forum/aio-libs

Example

.. code:: python

import asyncio
from aiohttp import web
from aiohttp.web import Response
from aiohttp_sse import sse_response
from datetime import datetime


async def hello(request):
    loop = request.app.loop
    async with sse_response(request) as resp:
        while True:
            data = 'Server Time : {}'.format(datetime.now())
            print(data)
            await resp.send(data)
            await asyncio.sleep(1, loop=loop)
    return resp


async def index(request):
    d = """
        <html>
        <body>
            <script>
                var evtSource = new EventSource("/hello");
                evtSource.onmessage = function(e) {
                    document.getElementById('response').innerText = e.data
                }
            </script>
            <h1>Response from server:</h1>
            <div id="response"></div>
        </body>
    </html>
    """
    return Response(text=d, content_type='text/html')


app = web.Application()
app.router.add_route('GET', '/hello', hello)
app.router.add_route('GET', '/', index)
web.run_app(app, host='127.0.0.1', port=8080)

EventSource Protocol

Requirements

  • Python_ 3.5+
  • aiohttp_ 3+

License

The aiohttp-sse is offered under Apache 2.0 license.

.. _Python: https://www.python.org .. _asyncio: http://docs.python.org/3.5/library/asyncio.html .. _aiohttp: https://github.com/aio-libs/aiohttp

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].