Skip to content

Commit

Permalink
Tornado docs
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Jun 28, 2018
1 parent 1b6483f commit 0ef4fbf
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ features:
- Compatible with Python 2.7 and Python 3.3+.
- Supports large number of clients even on modest hardware when used with an
asynchronous server based on `asyncio <https://docs.python.org/3/library/asyncio.html>`_
(`sanic <http://sanic.readthedocs.io/>`_ and `aiohttp <http://aiohttp.readthedocs.io/>`_),
(`sanic <http://sanic.readthedocs.io/>`_, `aiohttp <http://aiohttp.readthedocs.io/>`_ or
`tornado <http://www.tornadoweb.org/>`_),
`eventlet <http://eventlet.net/>`_ or `gevent <http://gevent.org>`_. For
development and testing, any WSGI compliant multi-threaded server can also be
used.
Expand Down Expand Up @@ -203,6 +204,39 @@ The aiohttp application is then executed in the usual manner::
if __name__ == '__main__':
web.run_app(app)

Tornado
~~~~~~~

`Tornado <http://www.tornadoweb.org//>`_ is a web framework with support
for HTTP and WebSocket. Support for this framework requires Python 3.5 and
newer. Only Tornado version 5 and newer are supported, thanks to its tight
integration with asyncio.

Instances of class ``engineio.AsyncServer`` will automatically use tornado
for asynchronous operations if the library is installed. To request its use
explicitly, the ``async_mode`` option can be given in the constructor::

eio = engineio.AsyncServer(async_mode='tornado')

A server configured for tornado must include a request handler for
Engine.IO::

app = tornado.web.Application(
[
(r"/engine.io/", engineio.get_tornado_handler(eio)),
],
# ... other application options
)

The tornado application can define other routes that will coexist with the
Engine.IO server. A typical pattern is to add routes that serve a client
application and any associated static files.

The tornado application is then executed in the usual manner::

app.listen(port)
tornado.ioloop.IOLoop.current().start()

Eventlet
~~~~~~~~

Expand Down

0 comments on commit 0ef4fbf

Please sign in to comment.