{ "info": { "author": "Matelabs", "author_email": "yb@matelabs.in", "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\nThis is a forked version of socketIO_client. You can find the original `here `_.\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\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/MateLabs/socketIO-client", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "socketIO-client-MV", "package_url": "https://pypi.org/project/socketIO-client-MV/", "platform": "", "project_url": "https://pypi.org/project/socketIO-client-MV/", "project_urls": { "Homepage": "https://github.com/MateLabs/socketIO-client" }, "release_url": "https://pypi.org/project/socketIO-client-MV/0.7.2/", "requires_dist": [ "requests (>=2.7.0)", "six", "websocket-client" ], "requires_python": "", "summary": "A socket.io client library", "version": "0.7.2" }, "last_serial": 5394484, "releases": { "0.7.2": [ { "comment_text": "", "digests": { "md5": "f7a1602521049e5872c8fc2ad86edf6c", "sha256": "65620b32e5d6a1fe27a658769a62d0d7a7d35df4c3cedd633e544369208f96b1" }, "downloads": -1, "filename": "socketIO_client_MV-0.7.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f7a1602521049e5872c8fc2ad86edf6c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23782, "upload_time": "2019-06-13T06:39:47", "url": "https://files.pythonhosted.org/packages/b8/5d/0d5d21029e6fac67f32e8211a7ee755479160de1634fbce0ff746deb0753/socketIO_client_MV-0.7.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1eee27f00a61f33c761f48de46626b71", "sha256": "db5d186d3614d3e5d58c45cfbf1935c108276248572144f69ff45cc309e4c96b" }, "downloads": -1, "filename": "socketIO-client-MV-0.7.2.tar.gz", "has_sig": false, "md5_digest": "1eee27f00a61f33c761f48de46626b71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20357, "upload_time": "2019-06-13T06:39:50", "url": "https://files.pythonhosted.org/packages/ac/aa/5c465a8ac7ed8ac90d8e4755129b87a05161e8c8c4bf884eba543f1c6f28/socketIO-client-MV-0.7.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f7a1602521049e5872c8fc2ad86edf6c", "sha256": "65620b32e5d6a1fe27a658769a62d0d7a7d35df4c3cedd633e544369208f96b1" }, "downloads": -1, "filename": "socketIO_client_MV-0.7.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f7a1602521049e5872c8fc2ad86edf6c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23782, "upload_time": "2019-06-13T06:39:47", "url": "https://files.pythonhosted.org/packages/b8/5d/0d5d21029e6fac67f32e8211a7ee755479160de1634fbce0ff746deb0753/socketIO_client_MV-0.7.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1eee27f00a61f33c761f48de46626b71", "sha256": "db5d186d3614d3e5d58c45cfbf1935c108276248572144f69ff45cc309e4c96b" }, "downloads": -1, "filename": "socketIO-client-MV-0.7.2.tar.gz", "has_sig": false, "md5_digest": "1eee27f00a61f33c761f48de46626b71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20357, "upload_time": "2019-06-13T06:39:50", "url": "https://files.pythonhosted.org/packages/ac/aa/5c465a8ac7ed8ac90d8e4755129b87a05161e8c8c4bf884eba543f1c6f28/socketIO-client-MV-0.7.2.tar.gz" } ] }