@@ -20,7 +20,8 @@ features:
2020- Compatible with Python 2.7 and Python 3.3+.
2121- Supports large number of clients even on modest hardware when used with an
2222 asynchronous server based on `asyncio <https://docs.python.org/3/library/asyncio.html >`_
23- (`sanic <http://sanic.readthedocs.io/ >`_ and `aiohttp <http://aiohttp.readthedocs.io/ >`_),
23+ (`sanic <http://sanic.readthedocs.io/ >`_, `aiohttp <http://aiohttp.readthedocs.io/ >`_ or
24+ `tornado <http://www.tornadoweb.org/ >`_),
2425 `eventlet <http://eventlet.net/ >`_ or `gevent <http://gevent.org >`_. For
2526 development and testing, any WSGI compliant multi-threaded server can also be
2627 used.
@@ -512,6 +513,39 @@ The aiohttp application is then executed in the usual manner::
512513 if __name__ == '__main__':
513514 web.run_app(app)
514515
516+ Tornado
517+ ~~~~~~~
518+
519+ `Tornado <http://www.tornadoweb.org// >`_ is a web framework with support
520+ for HTTP and WebSocket. Support for this framework requires Python 3.5 and
521+ newer. Only Tornado version 5 and newer are supported, thanks to its tight
522+ integration with asyncio.
523+
524+ Instances of class ``socketio.AsyncServer `` will automatically use tornado
525+ for asynchronous operations if the library is installed. To request its use
526+ explicitly, the ``async_mode `` option can be given in the constructor::
527+
528+ sio = socketio.AsyncServer(async_mode='tornado')
529+
530+ A server configured for tornado must include a request handler for
531+ Engine.IO::
532+
533+ app = tornado.web.Application(
534+ [
535+ (r"/socketio.io/", socketio.get_tornado_handler(sio)),
536+ ],
537+ # ... other application options
538+ )
539+
540+ The tornado application can define other routes that will coexist with the
541+ Socket.IO server. A typical pattern is to add routes that serve a client
542+ application and any associated static files.
543+
544+ The tornado application is then executed in the usual manner::
545+
546+ app.listen(port)
547+ tornado.ioloop.IOLoop.current().start()
548+
515549Eventlet
516550~~~~~~~~
517551
0 commit comments