{ "info": { "author": "Flavio Grossi", "author_email": "flaviogrossi@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Twisted", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. contents:: Table of contents\n\n\nSockJS-cyclone\n==============\n\n.. image:: https://badge.fury.io/py/sockjs-cyclone.png\n :target: https://pypi.python.org/pypi/sockjs-cyclone\n\n.. image:: https://secure.travis-ci.org/flaviogrossi/sockjs-cyclone.png?branch=master\n :target: http://travis-ci.org/#!/flaviogrossi/sockjs-cyclone\n\n.. image:: https://pypip.in/d/sockjs-cyclone/badge.png\n :target: https://crate.io/packages/sockjs-cyclone/\n\nSockJS-cyclone is a pure Python server implementation for the\n`SockJS client library `_\nrunning on the `Cyclone `_ web server.\n\nSockJS-cyclone is released under the `MIT license\n`_.\n\nWhat is SockJS?\n---------------\n\n`SockJS `_ is a browser JavaScript library that provides a\nWebSocket-like object. SockJS gives you a coherent, cross-browser, JavaScript\nAPI which creates a low latency, full duplex, cross-domain communication\nchannel between the browser and the web server, which consistently works across\nold browsers, misconfigured or old proxies and firewalls, etc. by automatically\nusing other transports as a fallback mechanism.\n\nSockJS main features:\n\n- simple APIs, as close to the WebSocket API as possible;\n- scaling and load balancing techniques;\n- very fast connection establishment;\n- pure JavaScript library on the client-side, no flash needed;\n- very extensive code testing available for both the server and client sides.\n\nSockJS-cyclone fully supports the SockJS protocol version 0.3.3.\n\nWhat is Cyclone?\n----------------\n\n`Cyclone `_ is a very fast and scalable web server framework\nthat implements the Tornado API as a Twisted protocol.\n\nHow does it look like?\n----------------------\n\nA live demo deployed on Heroku can be found `here `_.\n\nHere is a small example for an echo server:\n\n.. code-block:: python\n\n from twisted.internet import reactor\n import cyclone\n import sockjs.cyclone\n\n class EchoConnection(sockjs.cyclone.SockJSConnection):\n def messageReceived(self, message):\n self.sendMessage(message)\n\n if __name__ == \"__main__\":\n EchoRouter = sockjs.cyclone.SockJSRouter(EchoConnection, '/echo')\n app = cyclone.web.Application(EchoRouter.urls)\n reactor.listenTCP(8888, app)\n reactor.run()\n\nand an excerpt for the client:\n\n.. code-block:: javascript\n\n var sock = new SockJS('http://mydomain.com/echo');\n sock.onopen = function() {\n console.log('open');\n };\n sock.onmessage = function(e) {\n console.log('message', e.data);\n };\n sock.onclose = function() {\n console.log('close');\n };\n sock.send('hello!');\n\nComplete examples `can be found here `_.\n\nMultiplexing\n------------\n\nSockJS-Cyclone supports multiplexing (multiple distinct channels over a single\nshared connection):\n\n.. code-block:: python\n\n from twisted.internet import reactor\n import cyclone\n from sockjs.cyclone.conn import SockJSConnection, MultiplexConnection\n from sockjs.cyclone.router import SockJSRouter\n\n class AnnConnection(SockJSConnection):\n def messageReceived(self, message):\n self.sendMessage('Ann received ' + message)\n\n class BobConnection(SockJSConnection):\n def messageReceived(self, message):\n self.sendMessage('Bob received ' + message)\n\n class CarlConnection(SockJSConnection):\n def messageReceived(self, message):\n self.sendMessage('Carl received ' + message)\n\n if __name__ == \"__main__\":\n multiplexConnection = MultiplexConnection.create(ann=AnnConnection,\n bob=BobConnection,\n carl=CarlConnection)\n\n echoRouter = SockJSRouter(multiplexConnection, '/echo')\n\n app = cyclone.web.Application(echoRouter.urls)\n reactor.listenTCP(8888, app)\n reactor.run()\n\nSee the `websocket-multiplex `_\nlibrary for the client support, and the `complete example \n`_.\n\n\nInstallation\n============\n\nInstall from pypi with:\n\n::\n\n pip install sockjs-cyclone\n\nor from the latest sources with:\n\n::\n\n git clone https://github.com/flaviogrossi/sockjs-cyclone.git\n cd sockjs-cyclone\n python setup.py install\n\n\nSockJS-cyclone API\n==================\n\nThe main interaction with SockJS-cyclone happens via the two classes\n``SockJSRouter`` and ``SockJSConnection``.\n\nSockJSConnection\n----------------\n\nThe ``SockJSConnection`` class represent a connection with a client and\ncontains the logic of your application. Its main methods are:\n\n- ``connectionMade(request)``: called when the connection with the client is\n established;\n- ``messageReceived(message)``: called when a new message is received from the\n client;\n- ``sendMessage(message)``: call when you want to send a new message to the\n client;\n- ``close()``: close the connection;\n- ``connectionLost()``: called when the connection with the client is lost or\n explicitly closed.\n\nSockJSRouter\n------------\n\nThe ``SockJSRouter`` class routes the requests to the various connections\naccording to the url prefix. Its main methods are:\n\n- ``__init__(connection, prefix, user_settings)``: bounds the given connection\n to the given url prefix;\n- ``urls``: read only property to be used to initialize the cyclone application\n with all the needed sockjs urls.\n\n\nDeployment\n==========\n\nSockJS servers are usually deployed in production behind reverse proxies and/or\nload balancers. The most used options are currently `Nginx `_\nand `HAProxy `_.\n\nFor Heroku deployment, see the `quickstart instructions here `_.\n\nNginx\n-----\n\nTwo major options are needed to fully support proxying requests to a\nSockJS-Cyclone server: setting the HTTP protocol version to 1.1 and `passing\nupgrade headers to the server `_.\nThe relevant portion of the required configuration is:\n\n::\n\n server {\n listen 80;\n server_name localhost;\n\n location / {\n proxy_pass http://:;\n proxy_http_version 1.1;\n proxy_set_header Upgrade $http_upgrade;\n proxy_set_header Connection \"upgrade\";\n proxy_set_header Host $http_host;\n proxy_set_header X-Real-IP $remote_addr;\n }\n\n }\n\nFor websocket support, nginx version 1.3.13 or above is needed.\n\nA working ``nginx.conf`` example can be found `in the examples directory `_.\n\nHAProxy\n-------\n\nA complete example for HAProxy deployment and load balancing can be found on\n``SockJS-Node`` `Readme `_.\n\n\nCredits\n=======\n\nThanks to:\n\n- Serge S. Koval for the tornado implementation;\n- VoiSmart s.r.l for sponsoring the project.", "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/flaviogrossi/sockjs-cyclone/", "keywords": "sockjs,cyclone,web server,websocket", "license": "Copyright (C) 2012 Flavio Grossi\nCopyright (C) 2011 Serge S. Koval\n\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "sockjs-cyclone", "package_url": "https://pypi.org/project/sockjs-cyclone/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/sockjs-cyclone/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/flaviogrossi/sockjs-cyclone/" }, "release_url": "https://pypi.org/project/sockjs-cyclone/1.0.2/", "requires_dist": null, "requires_python": null, "summary": "SockJS python server for the Cyclone Web Server", "version": "1.0.2" }, "last_serial": 927725, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "29f1ddc45c4e73176adbdb79deb0c4bd", "sha256": "b562b4796d6634eb7981305386d362689aa4c8fbb67da64c33f9d40f39debdee" }, "downloads": -1, "filename": "sockjs-cyclone-0.0.1.tar.gz", "has_sig": false, "md5_digest": "29f1ddc45c4e73176adbdb79deb0c4bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16598, "upload_time": "2012-06-30T15:09:19", "url": "https://files.pythonhosted.org/packages/1c/b4/dbd1e016bd09f8ba04bd799b852d891dd0c1dad34188bf385a2ade3f683f/sockjs-cyclone-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f76711f4878f050d8f00f98d53867469", "sha256": "3d5484c26307d0e8300287d7b9fb2a68a84ad0d4d1744e8e6be8fb9914999ef0" }, "downloads": -1, "filename": "sockjs-cyclone-0.0.2.tar.gz", "has_sig": false, "md5_digest": "f76711f4878f050d8f00f98d53867469", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16192, "upload_time": "2012-11-07T14:23:54", "url": "https://files.pythonhosted.org/packages/4a/08/ec984cb5465621d251df001fc112ad1a82b4f1f405c4f27cb2cc31718fd4/sockjs-cyclone-0.0.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "882dbbbb5e374424d7cb59590fd99da6", "sha256": "12b8201075f0e56bd789a72f2fd92913f9c8d9ac69737e27320007a94bdd9d64" }, "downloads": -1, "filename": "sockjs-cyclone-1.0.0.tar.gz", "has_sig": false, "md5_digest": "882dbbbb5e374424d7cb59590fd99da6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19755, "upload_time": "2013-11-01T10:14:05", "url": "https://files.pythonhosted.org/packages/64/81/b9d0dcac63ea05d0b8a4605c0840ca875e48e0831e64c8d3974bfad4be6f/sockjs-cyclone-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "ffb7c9bfa9d09fa37d899460d7692e59", "sha256": "6d8982560744fa08431d23b840397d2408969444b6fecd198fa5bc9655c8076d" }, "downloads": -1, "filename": "sockjs-cyclone-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ffb7c9bfa9d09fa37d899460d7692e59", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19867, "upload_time": "2013-11-03T11:07:41", "url": "https://files.pythonhosted.org/packages/37/b7/4f0d93da2a149dda1e913d29d540aa8566ec39dd4f3ebe5b8cdd0f122a28/sockjs-cyclone-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "a656e58e952a81c54f819c5436f66ee8", "sha256": "6da8ca7046388b0b3e9108225b1287e3f00d4787bb9d516b13cd2b49b8806aab" }, "downloads": -1, "filename": "sockjs-cyclone-1.0.2.tar.gz", "has_sig": false, "md5_digest": "a656e58e952a81c54f819c5436f66ee8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19865, "upload_time": "2013-11-24T11:37:15", "url": "https://files.pythonhosted.org/packages/9f/45/6514c64524c98d96ffc337bedeb2ceba1fe2d8e58f25b3f00573ba7f9cdf/sockjs-cyclone-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a656e58e952a81c54f819c5436f66ee8", "sha256": "6da8ca7046388b0b3e9108225b1287e3f00d4787bb9d516b13cd2b49b8806aab" }, "downloads": -1, "filename": "sockjs-cyclone-1.0.2.tar.gz", "has_sig": false, "md5_digest": "a656e58e952a81c54f819c5436f66ee8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19865, "upload_time": "2013-11-24T11:37:15", "url": "https://files.pythonhosted.org/packages/9f/45/6514c64524c98d96ffc337bedeb2ceba1fe2d8e58f25b3f00573ba7f9cdf/sockjs-cyclone-1.0.2.tar.gz" } ] }