{ "info": { "author": "Paul Sokolovsky", "author_email": "pycopy-dev@googlegroups.com", "bugtrack_url": null, "classifiers": [], "description": "umqtt.simple\n============\n\numqtt is a simple MQTT client for Pycopy (https://github.com/pfalcon/pycopy).\n\nDesign requirements\n-------------------\n\n* Memory efficiency.\n* Avoid infamous design anti-patterns like \"callback hell\".\n* Support for both publishing and subscription via a single client\n object (another alternative would be to have separate client classes\n for publishing and subscription).\n\nAPI design\n----------\n\nBased on the requirements above, there are following API traits:\n\n* All data related to MQTT messages is encoded as bytes. This includes\n both message content AND topic names (even though MQTT spec states\n that topic name is UTF-8 encoded). The reason for this is simple:\n what is received over network socket is binary data (bytes) and\n it would require extra step to convert that to a string, spending\n memory on that. Note that this applies only to topic names (because\n they can be both sent and received). Other parameters specified by\n MQTT as UTF-8 encoded (e.g. ClientID) are accepted as strings.\n* Subscribed messages are delivered via a callback. This is to avoid\n using a queue for subscribed messages, as otherwise they may be\n received at any time (including when client expects other type\n of server response, so there're 2 choices: either deliver them\n immediately via a callback or queue up until an \"expected\" response\n arrives). Note that lack of need for a queue is delusive: the\n runtime call stack forms an implicit queue in this case. And unlike\n explicit queue, it's much harder to control. This design was chosen\n because in a common case of processing subscribed messages it's\n the most efficient. However, if in subscription callback, new\n messages of QoS>0 are published, this may lead to deep, or\n infinite recursion (the latter means an application will terminate\n with ``RuntimeException``).\n\nAPI reference\n-------------\n\nTaking into account API traits described above, umqtt pretty closely\nfollows MQTT control operations, and maps them to class methods:\n\n* ``connect(...)`` - Connect to a server. Returns True if this connection\n uses persisten session stored on a server (this will be always False if\n clean_session=True argument is used (default)).\n* ``disconnect()`` - Disconnect from a server, release resources.\n* ``ping()`` - Ping server (response is processed automatically by wait_msg()).\n* ``publish()`` - Publish a message.\n* ``subscribe()`` - Subscribe to a topic.\n* ``set_callback()`` - Set callback for received subscription messages.\n* ``set_last_will()`` - Set MQTT \"last will\" message. Should be called\n *before* connect().\n* ``wait_msg()`` - Wait for a server message. A subscription message will be\n delivered to a callback set with set_callback(), any other messages\n will be processed internally.\n* ``check_msg()`` - Check if there's pending message from server. If yes,\n process the same way as wait_msg(), if not, return immediately.\n\n``wait_msg()`` and ``check_msg()`` are \"main loop iteration\" methods, blocking\nand non-blocking version. They should be called periodically in a loop,\n``wait_msg()`` if you don't have any other foreground tasks to perform\n(i.e. your app just reacts to subscribed MQTT messages), ``check_msg()``\nif you process other foreground tasks too.\n\nNote that you don't need to call ``wait_msg()``/``check_msg()`` if you only\npublish messages, never subscribe to them.\n\nFor more detailed information about API please see the source code\n(which is quite short and easy to review) and provided examples.\n\n\nSupported MQTT features\n-----------------------\n\nQoS 0 and 1 are supported for both publish and subscribe. QoS2 isn't\nsupported to keep code size small. Besides ClientID, only \"clean\nsession\" parameter is supported for connect as of now.\n\n\nMQTT client with automatic reconnect\n------------------------------------\n\nThere's a separate `umqtt.robust` module which builds on `umqtt.simple`\nand adds automatic reconnect support in case of network errors.\nPlease see its documentation for further details.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pfalcon/pycopy-lib", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pycopy-umqtt.simple", "package_url": "https://pypi.org/project/pycopy-umqtt.simple/", "platform": "", "project_url": "https://pypi.org/project/pycopy-umqtt.simple/", "project_urls": { "Homepage": "https://github.com/pfalcon/pycopy-lib" }, "release_url": "https://pypi.org/project/pycopy-umqtt.simple/1.3.5/", "requires_dist": null, "requires_python": "", "summary": "Lightweight MQTT client for Pycopy", "version": "1.3.5" }, "last_serial": 5670111, "releases": { "1.3.4": [ { "comment_text": "", "digests": { "md5": "3418ae60b5286020a3cfc0c28596d869", "sha256": "94c689bdfaccb3c895a6230ecd6b86936c9d9a1bac735b51a5a9438bd12a20b7" }, "downloads": -1, "filename": "pycopy-umqtt.simple-1.3.4.tar.gz", "has_sig": false, "md5_digest": "3418ae60b5286020a3cfc0c28596d869", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4062, "upload_time": "2019-07-14T06:35:41", "url": "https://files.pythonhosted.org/packages/a4/7f/8250f0c94b5bb418b151860dfb08ffa1d996fe5ebe293e0a810f44275bf5/pycopy-umqtt.simple-1.3.4.tar.gz" } ], "1.3.5": [ { "comment_text": "", "digests": { "md5": "65168923cbdf1c478e8e8f6a0564724a", "sha256": "a98533776ff1548f86939a418b3afad4705e59cf3685c13cba0ffd9b63e3918f" }, "downloads": -1, "filename": "pycopy-umqtt.simple-1.3.5.tar.gz", "has_sig": false, "md5_digest": "65168923cbdf1c478e8e8f6a0564724a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4023, "upload_time": "2019-08-13T05:25:57", "url": "https://files.pythonhosted.org/packages/4c/c0/5ea031b509d4434d4c76ced9b0b22edf5a93bf78547b9a33e8673da47dc1/pycopy-umqtt.simple-1.3.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "65168923cbdf1c478e8e8f6a0564724a", "sha256": "a98533776ff1548f86939a418b3afad4705e59cf3685c13cba0ffd9b63e3918f" }, "downloads": -1, "filename": "pycopy-umqtt.simple-1.3.5.tar.gz", "has_sig": false, "md5_digest": "65168923cbdf1c478e8e8f6a0564724a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4023, "upload_time": "2019-08-13T05:25:57", "url": "https://files.pythonhosted.org/packages/4c/c0/5ea031b509d4434d4c76ced9b0b22edf5a93bf78547b9a33e8673da47dc1/pycopy-umqtt.simple-1.3.5.tar.gz" } ] }