{ "info": { "author": "Roy Hyunjin Han, Halil Ozercan", "author_email": "halilozercan@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python" ], "description": ".. image:: https://travis-ci.org/invisibleroads/socketIO-client.svg?branch=master\n :target: https://travis-ci.org/invisibleroads/socketIO-client\n\n\nsocketIO-client\n===============\nHere is a `socket.io `_ client library for Python. You can use it to write test code for your socket.io server.\n\nPlease note that this version implements `socket.io protocol 1.x `_, which is not backwards compatible. If you want to communicate using `socket.io protocol 0.9 `_ (which is compatible with `gevent-socketio `_), please use `socketIO-client 0.5.7.2 `_.\n\n\nInstallation\n------------\nInstall the package in an isolated environment. ::\n\n VIRTUAL_ENV=$HOME/.virtualenv\n\n # Prepare isolated environment\n virtualenv $VIRTUAL_ENV\n\n # Activate isolated environment\n source $VIRTUAL_ENV/bin/activate\n\n # Install package\n pip install -U socketIO-client\n\n\nUsage\n-----\nActivate isolated environment. ::\n\n VIRTUAL_ENV=$HOME/.virtualenv\n source $VIRTUAL_ENV/bin/activate\n\nLaunch your socket.io server. ::\n\n cd $(python -c \"import os, socketIO_client;\\\n print(os.path.dirname(socketIO_client.__file__))\")\n\n DEBUG=* node tests/serve.js # Start socket.io server in terminal one\n DEBUG=* node tests/proxy.js # Start proxy server in terminal two\n nosetests # Run tests in terminal three\n\nFor debugging information, run these commands first. ::\n\n import logging\n logging.getLogger('socketIO-client').setLevel(logging.DEBUG)\n logging.basicConfig()\n\nEmit. ::\n\n from socketIO_client import SocketIO, LoggingNamespace\n\n with SocketIO('127.0.0.1', 8000, LoggingNamespace) as socketIO:\n socketIO.emit('aaa')\n socketIO.wait(seconds=1)\n\nEmit with callback. ::\n\n from socketIO_client import SocketIO, LoggingNamespace\n\n def on_bbb_response(*args):\n print('on_bbb_response', args)\n\n with SocketIO('127.0.0.1', 8000, LoggingNamespace) as socketIO:\n socketIO.emit('bbb', {'xxx': 'yyy'}, on_bbb_response)\n socketIO.wait_for_callbacks(seconds=1)\n\nDefine events. ::\n\n from socketIO_client import SocketIO, LoggingNamespace\n\n def on_connect():\n print('connect')\n\n def on_disconnect():\n print('disconnect')\n\n def on_reconnect():\n print('reconnect')\n\n def on_aaa_response(*args):\n print('on_aaa_response', args)\n\n socketIO = SocketIO('127.0.0.1', 8000, LoggingNamespace)\n socketIO.on('connect', on_connect)\n socketIO.on('disconnect', on_disconnect)\n socketIO.on('reconnect', on_reconnect)\n\n # Listen\n socketIO.on('aaa_response', on_aaa_response)\n socketIO.emit('aaa')\n socketIO.emit('aaa')\n socketIO.wait(seconds=1)\n\n # Stop listening\n socketIO.off('aaa_response')\n socketIO.emit('aaa')\n socketIO.wait(seconds=1)\n\n # Listen only once\n socketIO.once('aaa_response', on_aaa_response)\n socketIO.emit('aaa') # Activate aaa_response\n socketIO.emit('aaa') # Ignore\n socketIO.wait(seconds=1)\n\nDefine events in a namespace. ::\n\n from socketIO_client import SocketIO, BaseNamespace\n\n class Namespace(BaseNamespace):\n\n def on_aaa_response(self, *args):\n print('on_aaa_response', args)\n self.emit('bbb')\n\n socketIO = SocketIO('127.0.0.1', 8000, Namespace)\n socketIO.emit('aaa')\n socketIO.wait(seconds=1)\n\nDefine standard events. ::\n\n from socketIO_client import SocketIO, BaseNamespace\n\n class Namespace(BaseNamespace):\n\n def on_connect(self):\n print('[Connected]')\n\n def on_reconnect(self):\n print('[Reconnected]')\n\n def on_disconnect(self):\n print('[Disconnected]')\n\n socketIO = SocketIO('127.0.0.1', 8000, Namespace)\n socketIO.wait(seconds=1)\n\nDefine different namespaces on a single socket. ::\n\n from socketIO_client import SocketIO, BaseNamespace\n\n class ChatNamespace(BaseNamespace):\n\n def on_aaa_response(self, *args):\n print('on_aaa_response', args)\n\n class NewsNamespace(BaseNamespace):\n\n def on_aaa_response(self, *args):\n print('on_aaa_response', args)\n\n socketIO = SocketIO('127.0.0.1', 8000)\n chat_namespace = socketIO.define(ChatNamespace, '/chat')\n news_namespace = socketIO.define(NewsNamespace, '/news')\n\n chat_namespace.emit('aaa')\n news_namespace.emit('aaa')\n socketIO.wait(seconds=1)\n\nConnect via SSL (https://github.com/invisibleroads/socketIO-client/issues/54). ::\n\n from socketIO_client import SocketIO\n\n # Skip server certificate verification\n SocketIO('https://127.0.0.1', verify=False)\n # Verify the server certificate\n SocketIO('https://127.0.0.1', verify='server.crt')\n # Verify the server certificate and encrypt using client certificate\n socketIO = SocketIO('https://127.0.0.1', verify='server.crt', cert=(\n 'client.crt', 'client.key'))\n\nSpecify params, headers, cookies, proxies thanks to the `requests `_ library. ::\n\n from socketIO_client import SocketIO\n from base64 import b64encode\n\n SocketIO(\n '127.0.0.1', 8000,\n params={'q': 'qqq'},\n headers={'Authorization': 'Basic ' + b64encode('username:password')},\n cookies={'a': 'aaa'},\n proxies={'https': 'https://proxy.example.com:8080'})\n\nWait forever. ::\n\n from socketIO_client import SocketIO\n\n socketIO = SocketIO('127.0.0.1', 8000)\n socketIO.wait()\n\nDon't wait forever. ::\n\n from requests.exceptions import ConnectionError\n from socketIO_client import SocketIO\n\n try:\n socket = SocketIO('127.0.0.1', 8000, wait_for_connection=False)\n socket.wait()\n except ConnectionError:\n print('The server is down. Try again later.')\n\n\nLicense\n-------\nThis software is available under the MIT License.\n\n\nCredits\n-------\n- `Guillermo Rauch `_ wrote the `socket.io specification `_.\n- `Hiroki Ohtani `_ wrote `websocket-client `_.\n- `Roderick Hodgson `_ wrote a `prototype for a Python client to a socket.io server `_.\n- `Alexandre Bourget `_ wrote `gevent-socketio `_, which is a socket.io server written in Python.\n- `Paul Kienzle `_, `Zac Lee `_, `Josh VanderLinden `_, `Ian Fitzpatrick `_, `Lucas Klein `_, `Rui Chicoria `_, `Travis Odom `_, `Patrick Huber `_, `Brad Campbell `_, `Daniel `_, `Sean Arietta `_, `Sacha Stafyniak `_ submitted code to expand support of the socket.io protocol.\n- `Bernard Pratz `_, `Francis Bull `_ wrote prototypes to support xhr-polling and jsonp-polling.\n- `Joe Palmer `_ sponsored development.\n- `Eric Chen `_, `Denis Zinevich `_, `Thiago Hersan `_, `Nayef Copty `_, `J\u00f6rgen Karlsson `_, `Branden Ghena `_, `Tim Landscheidt `_, `Matt Porritt `_, `Matt Dainty `_, `Thomaz de Oliveira dos Reis `_, `Felix K\u00f6nig `_, `George Wilson `_, `Andreas Strikos `_, `Alessio Sergi `_ `Claudio Yacarini `_, `Khairi Hafsham `_, `Robbie Clarken `_ suggested ways to make the connection more robust.\n- `Merlijn van Deen `_, `Frederic Sureau `_, `Marcus Cobden `_, `Drew Hutchison `_, `wuurrd `_, `Adam Kecer `_, `Alex Monk `_, `Vishal P R `_, `John Vandenberg `_, `Thomas Grainger `_, `Daniel Quinn `_, `Adric Worley `_, `Adam Roses Wight `_, `Jan V\u010del\u00e1k `_ proposed changes that make the library more friendly and practical for you!\n\n\n0.7\n---\n- Fixed thread cleanup\n- Fixed disconnect detection if defined directly thanks to Andreas Strikos\n- Fixed support for unicode payloads\n\n0.6\n---\n- Upgraded to socket.io protocol 1.x thanks to Sean Arietta and Joe Palmer\n- Fixed support for Python 3\n- Fixed SSL support\n- Added locks to fix concurrency issues with polling transport\n- Added SocketIO.off() and SocketIO.once()\n\n0.5\n---\n- Added support for Python 3\n- Added support for jsonp-polling thanks to Bernard Pratz\n- Added support for xhr-polling thanks to Francis Bull\n- Added support for query params and cookies\n- Fixed sending acknowledgments in custom namespaces thanks to Travis Odom\n- Rewrote library to use coroutines instead of threads to save memory\n\n0.4\n---\n- Added support for custom headers and proxies thanks to Rui and Sajal\n- Added support for server-side callbacks thanks to Zac Lee\n- Merged Channel functionality into BaseNamespace thanks to Alexandre Bourget\n\n0.3\n---\n- Added support for secure connections\n- Added SocketIO.wait()\n- Improved exception handling in _RhythmicThread and _ListenerThread\n\n0.2\n---\n- Added support for callbacks and channels thanks to Paul Kienzle\n- Incorporated suggestions from Josh VanderLinden and Ian Fitzpatrick\n\n0.1\n---\n- Wrapped `code from StackOverflow `_\n- Added exception handling to destructor in case of connection failure\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/halilozercan/py-socketio-client", "keywords": "socket.io node.js", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "py-socketio-client", "package_url": "https://pypi.org/project/py-socketio-client/", "platform": "", "project_url": "https://pypi.org/project/py-socketio-client/", "project_urls": { "Homepage": "https://github.com/halilozercan/py-socketio-client" }, "release_url": "https://pypi.org/project/py-socketio-client/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "A socket.io client library", "version": "0.0.1" }, "last_serial": 3895018, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2875fe9257cfa555e2dccb1c10471abd", "sha256": "6f0b6b848d38aafbca1c225caa9f0ba58336b4000ae083975d9b261a9ca336bb" }, "downloads": -1, "filename": "py-socketio-client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2875fe9257cfa555e2dccb1c10471abd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17272, "upload_time": "2018-05-24T12:22:36", "url": "https://files.pythonhosted.org/packages/6b/51/fdab2888148b6570dcb17ee937aff7cb856fe90fc1d063bcdf9fe57852b4/py-socketio-client-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2875fe9257cfa555e2dccb1c10471abd", "sha256": "6f0b6b848d38aafbca1c225caa9f0ba58336b4000ae083975d9b261a9ca336bb" }, "downloads": -1, "filename": "py-socketio-client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2875fe9257cfa555e2dccb1c10471abd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17272, "upload_time": "2018-05-24T12:22:36", "url": "https://files.pythonhosted.org/packages/6b/51/fdab2888148b6570dcb17ee937aff7cb856fe90fc1d063bcdf9fe57852b4/py-socketio-client-0.0.1.tar.gz" } ] }