@@ -628,6 +628,25 @@ Deployment Strategies
628
628
The following sections describe a variety of deployment strategies for
629
629
Socket.IO servers.
630
630
631
+ Uvicorn, Daphne, and other ASGI servers
632
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
633
+
634
+ The ``socketio.ASGIApp `` class is an ASGI compatible application that can
635
+ forward Socket.IO traffic to an ``socketio.AsyncServer `` instance::
636
+
637
+ sio = socketio.AsyncServer(async_mode='asgi')
638
+ app = socketio.ASGIApp(sio)
639
+
640
+ If desired, the ``socketio.ASGIApp `` class can forward any traffic that is not
641
+ Socket.IO to another ASGI application, making it possible to deploy a standard
642
+ ASGI web application and the Socket.IO server as a bundle::
643
+
644
+ sio = socketio.AsyncServer(async_mode='asgi')
645
+ app = socketio.ASGIApp(sio, other_app)
646
+
647
+ The ``ASGIApp `` instance is a fully complaint ASGI instance that can be
648
+ deployed with an ASGI compatible web server.
649
+
631
650
Aiohttp
632
651
~~~~~~~
633
652
@@ -691,6 +710,10 @@ The tornado application is then executed in the usual manner::
691
710
Sanic
692
711
~~~~~
693
712
713
+ Note: Due to some backward incompatible changes introduced in recent versions
714
+ of Sanic, it is currently recommended that a Sanic application is deployed with
715
+ the ASGI integration instead.
716
+
694
717
`Sanic <http://sanic.readthedocs.io/ >`_ is a very efficient asynchronous web
695
718
server for Python 3.5 and newer.
696
719
@@ -726,17 +749,6 @@ setting in addition to any other configuration that you use::
726
749
727
750
app.config['CORS_SUPPORTS_CREDENTIALS'] = True
728
751
729
- Uvicorn, Daphne, and other ASGI servers
730
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
731
-
732
- The ``socketio.ASGIApp `` class is an ASGI compatible application that can
733
- forward Socket.IO traffic to an ``socketio.AsyncServer `` instance::
734
-
735
- sio = socketio.AsyncServer(async_mode='asgi')
736
- app = socketio.ASGIApp(sio)
737
-
738
- The application can then be deployed with any ASGI compatible web server.
739
-
740
752
Eventlet
741
753
~~~~~~~~
742
754
0 commit comments