Skip to content

Commit

Permalink
Recommend ASGI integration for Sanic in Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Oct 14, 2022
1 parent de44594 commit bf9d8ea
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions docs/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,26 @@ Deployment Strategies
The following sections describe a variety of deployment strategies for
Engine.IO servers.

aiohttp
Uvicorn, Daphne, and other ASGI servers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``engineio.ASGIApp`` class is an ASGI compatible application that can
forward Engine.IO traffic to an ``engineio.AsyncServer`` instance::

eio = engineio.AsyncServer(async_mode='asgi')
app = engineio.ASGIApp(eio)

If desired, the ``engineio.ASGIApp`` class can forward any traffic that is not
Engine.IO to another ASGI application, making it possible to deploy a standard
ASGI web application and the Engine.IO server as a bundle::

eio = engineio.AsyncServer(async_mode='asgi')
app = engineio.ASGIApp(eio, other_app)

The ``ASGIApp`` instance is a fully complaint ASGI instance that can be
deployed with an ASGI compatible web server.

Aiohttp
~~~~~~~

`aiohttp <http://aiohttp.readthedocs.io/>`_ provides a framework with support
Expand Down Expand Up @@ -415,6 +434,10 @@ The tornado application is then executed in the usual manner::
Sanic
~~~~~

Note: Due to some backward incompatible changes introduced in recent versions
of Sanic, it is currently recommended that a Sanic application is deployed with
the ASGI integration instead.

`Sanic <http://sanic.readthedocs.io/>`_ is a very efficient asynchronous web
server for Python.

Expand Down Expand Up @@ -450,17 +473,6 @@ setting in addition to any other configuration that you use::

app.config['CORS_SUPPORTS_CREDENTIALS'] = True

Uvicorn, Daphne, and other ASGI servers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``engineio.ASGIApp`` class is an ASGI compatible application that can
forward Engine.IO traffic to an ``engineio.AsyncServer`` instance::

eio = engineio.AsyncServer(async_mode='asgi')
app = engineio.ASGIApp(eio)

The application can then be deployed with any ASGI compatible web server.

Eventlet
~~~~~~~~

Expand Down

0 comments on commit bf9d8ea

Please sign in to comment.