{
"info": {
"author": "Serge S. Koval",
"author_email": "serge.koval@gmail.com",
"bugtrack_url": null,
"classifiers": [],
"description": "========\nTornadio\n========\n\nContributors\n------------\n\n- `Serge S. Koval `_\n\nCredits\n-------\n\nAuthors of SocketTornad.IO project:\n\n- Brendan W. McAdams bwmcadams@evilmonkeylabs.com\n- `Matt Swanson `_\n\nThis is implementation of the `Socket.IO `_ realtime\ntransport library on top of the `Tornado `_ framework.\n\nShort Background\n----------------\n\nThere's a library which already implements Socket.IO integration using Tornado\nframework - `SocketTornad.IO `_, but\nit was not finished, has several known bugs and not very well structured.\n\nTornadIO is different from SocketTornad.IO library in following aspects:\n\n- Simpler internal design, easier to maintain/extend\n- No external dependencies (except of the Tornado itself and simplejson on python < 2.6)\n- Properly handles on_open/on_close events for polling transports\n- Proper Socket.IO protocol parser\n- Proper unicode support\n- Actively maintained\n\nIntroduction\n------------\n\nIn order to start working with the TornadIO library, you need to know some basic concepts\non how Tornado works. If you don't, please read Tornado tutorial, which can be found\n`here `_.\n\nIf you're familiar with Tornado, do following to add support for Socket.IO to your application:\n\n1. Derive from tornadio.SocketConnection class and override on_message method (on_open/on_close are optional):\n::\n\n class MyConnection(tornadio.SocketConnection):\n def on_message(self, message):\n pass\n\n2. Create handler object that will handle all `socket.io` transport related functionality:\n::\n\n MyRouter = tornadio.get_router(MyConnection)\n\n3. Add your handler routes to the Tornado application:\n::\n\n application = tornado.web.Application(\n [MyRouter.route()],\n socket_io_port = 8000)\n\n4. Start your application\n5. You have your `socket.io` server running at port 8000. Simple, right?\n\nGoodies\n-------\n\n``SocketConnection`` class provides three overridable methods:\n\n1. ``on_open`` called when new client connection was established.\n2. ``on_message`` called when message was received from the client. If client sent JSON object,\n it will be automatically decoded into appropriate Python data structures.\n3. ``on_close`` called when client connection was closed (due to network error, timeout or just client-side disconnect)\n\n\nEach ``SocketConnection`` has ``send()`` method which is used to send data to the client. Input parameter\ncan be one of the:\n\n1. String/unicode string - sent as is (though with utf-8 encoding)\n2. Arbitrary python object - encoded as JSON string automatically\n3. List of python objects/strings - encoded as series of the socket.io messages using one of the rules above.\n\nConfiguration\n-------------\n\nYou can configure your handler by passing settings to the ``get_router`` function as a ``dict`` object.\n\n- **enabled_protocols**: This is a ``list`` of the socket.io protocols the server will respond requests for.\n Possibilities are:\n- *websocket*: HTML5 WebSocket transport\n- *flashsocket*: Flash emulated websocket transport. Requires Flash policy server running on port 843.\n- *xhr-multipart*: Works with two connections - long GET connection with multipart transfer encoding to receive\n updates from the server and separate POST requests to send data from the client.\n- *xhr-polling*: Long polling AJAX request to read data from the server and POST requests to send data to the server.\n If message is available, it will be sent through open GET connection (which is then closed) or queued on the\n server otherwise.\n- *jsonp-polling*: Similar to the *xhr-polling*, but pushes data through the JSONp.\n- *htmlfile*: IE only. Creates HTMLFile control which reads data from the server through one persistent connection.\n POST requests are used to send data back to the server.\n\n\n- **session_check_interval**: Specifies how often TornadIO will check session container for expired session objects.\n In seconds.\n- **session_expiry**: Specifies session expiration interval, in seconds. For polling transports it is actually\n maximum time allowed between GET requests to consider virtual connection closed.\n- **heartbeat_interval**: Heartbeat interval for persistent transports. Specifies how often heartbeat events should\n be sent from the server to the clients.\n- **xhr_polling_timeout**: Timeout for long running XHR connection for *xhr-polling* transport, in seconds. If no\n data was available during this time, connection will be closed on server side to avoid client-side timeouts.\n\nResources\n^^^^^^^^^\n\nYou're not limited with one connection type per server - you can serve different clients in one server instance.\n\nBy default, all socket.io clients use same resource - 'socket.io'. You can change resource by passing `resource` parameter\nto the `get_router` function:\n::\n\n ChatRouter = tornadio.get_router(MyConnection, resource='chat')\n\nIn the client, provide resource you're connecting to, by passing `resource` parameter to `io.Socket` constructor:\n::\n\n sock = new io.Socket(window.location.hostname, {\n port: 8001,\n resource: 'chat',\n });\n\nAs it was said before, you can have as many connection types as you want by having unique resources for each connection type:\n::\n\n ChatRouter = tornadio.get_router(ChatConnection, resource='chat')\n PingRouter = tornadio.get_router(PingConnection, resource='ping')\n MapRouter = tornadio.get_router(MapConnection, resource='map')\n\n application = tornado.web.Application(\n [ChatRouter.route(), PingRouter.route(), MapRouter.route()],\n socket_io_port = 8000)\n\nExtra parameters\n^^^^^^^^^^^^^^^^\n\nIf you need some kind of user authentication in your application, you have two choices:\n\n1. Send authentication token as a first message from the client\n2. Provide authentication token as part of the `resource` parameter\n\nTornadIO has support for extra data passed through the `socket.io` resources.\n\nYou can provide regexp in `extra_re` parameter of the `get_router` function and matched data can be accessed\nin your `on_open` handler as `kwargs['extra']`. For example:\n::\n\n class MyConnection(tornadio.SocketConnection):\n def on_open(self, *args, **kwargs):\n print 'Extra: %s' % kwargs['extra']\n\n ChatRouter = tornadio.get_router(MyConnection, resource='chat', extra_re='\\d+', extra_sep='/')\n\nand on the client-side:\n::\n\n sock = new io.Socket(window.location.hostname, {\n port: 8001,\n resource: 'chat/123',\n });\n\nIf you will run this example and connect with sample client, you should see 'Extra: 123' printed out.\n\nStarting Up\n-----------\n\nBest Way: SocketServer\n^^^^^^^^^^^^^^^^^^^^^^\n\nWe provide customized version (shamelessly borrowed from the SocketTornad.IO library) of the HttpServer, which\nsimplifies start of your TornadIO server.\n\nTo start it, do following (assuming you created application object before)::\n\n if __name__ == \"__main__\":\n socketio_server = SocketServer(application)\n\nSocketServer will automatically start Flash policy server, if required.\n\nGoing big\n---------\n\nSo, you've finished writting your application and want to share it with rest of the world, so you started\nthinking about scalability, deployment options, etc.\n\nMost of the Tornado servers are deployed behind the nginx, which also used to serve static content. This\nwon't work very well with TornadIO, as nginx does not support HTTP/1.1, does not support websockets and\nXHR-Multipart transport just won't work.\n\nSo, to load balance your TornadIO instances, use alternative solutions like `HAProxy `_.\nHowever, HAProxy does not work on Windows, so if you plan to deploy your solution on Windows platform,\nyou might want to take look into `MLB `_.\n\nScalability is completely different beast. It is up for you, as a developer, to design scalable architecture\nof the application.\n\nFor example, if you need to have one large virtual server out of your multiple physical processes (or even servers),\nyou have to come up with some kind of the synchronization mechanism. This can be either common meeting point\n(and also point of failure), like memcached, redis, etc. Or you might want to use some transporting mechanism to\ncommunicate between servers, for example something `AMQP `_ based, `ZeroMQ `_ or\njust plain sockets with your protocol.\n\nFor example, with message queues, you can treat TornadIO as a message gateway between your clients and your server backend(s).\n\nExamples\n--------\n\nChatroom Example\n^^^^^^^^^^^^^^^^\n\nThere is a chatroom example application from the SocketTornad.IO library, contributed by\n`swanson `_. It is in the ``examples/chatroom`` directory.\n\nPing Example\n^^^^^^^^^^^^\n\nSimple ping/pong example to measure network performance. It is in the ``examples/ping`` directory.\n\nTransports Example\n^^^^^^^^^^^^^^^^^^\n\nSimple ping/pong example with chat-like interface with selectable transports. It is in the\n``examples/transports`` directory.",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://github.com/MrJoes/tornadio/",
"keywords": null,
"license": "Copyright (c) 2011, Serge. S. Koval. \n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.",
"maintainer": null,
"maintainer_email": null,
"name": "TornadIO",
"package_url": "https://pypi.org/project/TornadIO/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/TornadIO/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "http://github.com/MrJoes/tornadio/"
},
"release_url": "https://pypi.org/project/TornadIO/0.0.5/",
"requires_dist": null,
"requires_python": null,
"summary": "Socket.io server implementation on top of Tornado framework",
"version": "0.0.5"
},
"last_serial": 785814,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "20a47d2ad36aaa80985b9db105960e0a",
"sha256": "7ae9168773e8bf271c32b0211b8e290aee8dc5cd9eaf60145675ba8cbf7488fb"
},
"downloads": -1,
"filename": "TornadIO-0.0.1.zip",
"has_sig": false,
"md5_digest": "20a47d2ad36aaa80985b9db105960e0a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 21331,
"upload_time": "2011-01-27T14:21:08",
"url": "https://files.pythonhosted.org/packages/d5/f0/2634ae300da023bef1ac96873397d4d041831664a68a690e2bb45b9eb741/TornadIO-0.0.1.zip"
}
],
"0.0.3": [
{
"comment_text": "",
"digests": {
"md5": "04cf5696c76276aae21682c547ed47a6",
"sha256": "a8c1880eb83ed8f731ab6d777d321acc2999ca0004daeec47000ad5c39badab0"
},
"downloads": -1,
"filename": "TornadIO-0.0.3.zip",
"has_sig": false,
"md5_digest": "04cf5696c76276aae21682c547ed47a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 24685,
"upload_time": "2011-02-18T13:03:18",
"url": "https://files.pythonhosted.org/packages/29/bd/95e662abd289655b4309b4e1ce38cae73508872c1948d09daf145601ad94/TornadIO-0.0.3.zip"
}
],
"0.0.4": [
{
"comment_text": "",
"digests": {
"md5": "287410abf240024288740b5a30cc972b",
"sha256": "6fd22a57d5784fc6e88cd0345f6605b7a2ed653d12839fde47389ad397bbd680"
},
"downloads": -1,
"filename": "TornadIO-0.0.4.zip",
"has_sig": false,
"md5_digest": "287410abf240024288740b5a30cc972b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 24684,
"upload_time": "2011-02-27T12:05:14",
"url": "https://files.pythonhosted.org/packages/74/44/0d84615a80cb29c224634cc99b292dcd7cf06165c3ce0b51edf8e7e1279e/TornadIO-0.0.4.zip"
}
],
"0.0.5": [
{
"comment_text": "",
"digests": {
"md5": "9d7600862364edf846fd5b0efe165663",
"sha256": "b501f7921dd97f87bf0716083a7f7cc94d1e50182f4050e0eeed51999e2b947e"
},
"downloads": -1,
"filename": "TornadIO-0.0.5.zip",
"has_sig": false,
"md5_digest": "9d7600862364edf846fd5b0efe165663",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25102,
"upload_time": "2011-09-30T09:00:19",
"url": "https://files.pythonhosted.org/packages/09/92/62904f2c092fa1effff5ac967cf91728c58e64a3eb5f12fc420e9f4642f9/TornadIO-0.0.5.zip"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "9d7600862364edf846fd5b0efe165663",
"sha256": "b501f7921dd97f87bf0716083a7f7cc94d1e50182f4050e0eeed51999e2b947e"
},
"downloads": -1,
"filename": "TornadIO-0.0.5.zip",
"has_sig": false,
"md5_digest": "9d7600862364edf846fd5b0efe165663",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 25102,
"upload_time": "2011-09-30T09:00:19",
"url": "https://files.pythonhosted.org/packages/09/92/62904f2c092fa1effff5ac967cf91728c58e64a3eb5f12fc420e9f4642f9/TornadIO-0.0.5.zip"
}
]
}