Skip to content

Commit

Permalink
correctly autodetect asgi async mode (Fixes #122)
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Jun 29, 2019
1 parent 6b8e667 commit 2690ea0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 4 additions & 1 deletion engineio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
if sys.version_info >= (3, 5): # pragma: no cover
from .asyncio_server import AsyncServer
from .asyncio_client import AsyncClient
from .async_drivers.tornado import get_tornado_handler
from .async_drivers.asgi import ASGIApp
try:
from .async_drivers.tornado import get_tornado_handler
except ImportError:
get_tornado_handler = None
else: # pragma: no cover
AsyncServer = None
AsyncClient = None
Expand Down
7 changes: 2 additions & 5 deletions engineio/async_drivers/tornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
from urllib.parse import urlsplit
from .. import exceptions

try:
import tornado.web
import tornado.websocket
except ImportError: # pragma: no cover
pass
import tornado.web
import tornado.websocket
import six


Expand Down
6 changes: 4 additions & 2 deletions engineio/asyncio_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ class AsyncServer(server.Server):
section in the documentation for a description of the
available options. Valid async modes are "aiohttp",
"sanic", "tornado" and "asgi". If this argument is not
given, an async mode is chosen based on the installed
packages.
given, "aiohttp" is tried first, followed by "sanic",
"tornado", and finally "asgi". The first async mode that
has all its dependencies installed is the one that is
chosen.
:param ping_timeout: The time in seconds that the client waits for the
server to respond before disconnecting.
:param ping_interval: The interval in seconds at which the client pings
Expand Down

0 comments on commit 2690ea0

Please sign in to comment.