{ "info": { "author": "Paul Sokolovsky", "author_email": "pycopy-dev@googlegroups.com", "bugtrack_url": null, "classifiers": [], "description": "umqtt.robust\n============\n\numqtt is a simple MQTT client for Pycopy (https://github.com/pfalcon/pycopy).\nIt consists of two submodules: umqtt.simple and umqtt.robust. umqtt.robust\nis built on top of umqtt.simple and adds auto-reconnect facilities for some\nof networking errors.\n\nWhat does it mean to be \"robust\" ?\n----------------------------------\n\nModern computing systems are sufficiently complex and have multiple\npoints of failure. Consider for example that nothing will work if\nthere's no power (mains outage or battery ran out). As you may imagine,\numqtt.robust won't help you with your flat battery. Most computing\nsystems are now networked, and communication is another weak link.\nThis is especially true for wireless communications. If two of your\nsystems can't connect reliably communicate via WiFi, umqtt.robust\ncan't magically resolve that (but it may help with intermittent\nWiFi issues).\n\nWhat umqtt.robust tries to do is very simple - if while trying to\nperform some operation, it detects that connection to MQTT breaks,\nit tries to reconnect to it. That's good direction towards \"robustness\",\nbut the problem that there is no single definition of what \"robust\"\nis. Let's consider following usecase:\n\n1. A temperature reading gets transmitted once a minute. Then the\nbest option in case of a transmission error might be not doing\nanything at all - in a minute, another reading will be transmitted,\nand for slowly-changing parameter like a temperature, a one-minute\nlost reading is not a problem. Actually, if the sending device is\nbattery-powered, any connection retries will just drain battery and\nmake device \"less robust\" (it will run out of juice sooner and more\nunexpectedly, which may be a criteria for \"robustness\").\n\n2. If there's a button, which communicates its press event, then\nperhaps it's really worth to retry to deliver this event (a user\nexpects something to happen when they press the button, right?).\nBut if a button is battery-power, unconstrained retries won't do\nmuch good still. Consider mains power outage for several hours,\nMQTT server down all this time, and battery-powered button trying\nto re-publish event every second. It will likely drain battery\nduring this time, which is very non-robust. Perhaps, if a press\nisn't delivered in 15 seconds, it's no longer relevant (depending\non what press does, the above may be good for a button turning\non lights, but not for something else!)\n\n3. Finally, let's consider security sensors, like a window broken\nsensor. That's the hardest case. Apparently, those events are\nimportant enough to be delivered no matter what. But if done with\nshort, dumb retries, it will only lead to quick battery drain. So,\na robust device would retry, but in smart manner, to let battery\nrun for as long as possible, to maximize the chance of the message\nbeing delivered.\n\nLet's sum it up:\n\na) There's no single definition of what \"robust\" is. It depends on\n a particular application.\nb) Robustness is a complex measure, it doesn't depend on one single\n feature, but rather many different features working together.\n Consider for example that to make button from the case 2 above\n work better, it would help to add a visual feedback, so a user\n knew what happens.\n\nAs you may imagine, umqtt.robust doesn't, and can't, cover all possible\n\"robustness\" scenarios, nor it alone can make your MQTT application\n\"robust\". Rather, it's a barebones example of how to reconnect to an\nMQTT server in case of a connection error. As such, it's just one\nof many steps required to make your app robust, and majority of those\nsteps lie on *your application* side. With that in mind, any realistic\napplication would subclass umqtt.robust.MQTTClient class and override\ndelay() and reconnect() methods to suit particular usage scenario. It\nmay even happen that umqtt.robust won't even suit your needs, and you\nwill need to implement your \"robust\" handling from scratch.\n\n\nPersistent and non-persistent MQTT servers\n------------------------------------------\n\nConsider an example: you subscribed to some MQTT topics, then connection\nwent down. If we talk \"robust\", then once you reconnect, you want any\nmessages which arrived when the connection was down, to be still delivered\nto you. That requires retainment and persistency enabled on MQTT server.\nAs umqtt.robust tries to achieve as much \"robustness\" as possible, it\nmakes a requirement that the MQTT server it communicates to has persistency\nenabled. This include persistent sessions, meaning that any client\nsubscriptions are retained across disconnect, and if you subscribed once,\nyou no longer need to resubscribe again on next connection(s). This makes\nit more robust, minimizing amount of traffic to transfer on each connection\n(the more you transfer, the higher probability of error), and also saves\nbattery power.\n\nHowever, not all broker offer true, persistent MQTT support:\n\n* If you use self-hosted broker, you may need to configure it for\n persistency. E.g., a popular open-source broker Mosquitto requires\n following line::\n\n persistence true\n\n to be added to ``mosquitto.conf``. Please consult documentation of\n your broker.\n\n* Many so-called \"cloud providers\" offer very limited subset of MQTT for\n their free/inexpensive tiers. Persistence and QoS are features usually\n not supported. It's hard to achieve any true robustness with these\n demo-like offerings, and umqtt.robust isn't designed to work with them.\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.robust", "package_url": "https://pypi.org/project/pycopy-umqtt.robust/", "platform": "", "project_url": "https://pypi.org/project/pycopy-umqtt.robust/", "project_urls": { "Homepage": "https://github.com/pfalcon/pycopy-lib" }, "release_url": "https://pypi.org/project/pycopy-umqtt.robust/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "Lightweight MQTT client for Pycopy (\"robust\" version).", "version": "1.0.2" }, "last_serial": 5670119, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "de23517e3c41b18681a4e88fda76c2f2", "sha256": "ef6167a653554daf30af282f6a74f4cd9dd256fccf481cb3f6b6631a231a6b74" }, "downloads": -1, "filename": "pycopy-umqtt.robust-1.0.1.tar.gz", "has_sig": false, "md5_digest": "de23517e3c41b18681a4e88fda76c2f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5027, "upload_time": "2019-07-14T06:35:34", "url": "https://files.pythonhosted.org/packages/73/13/07ade5f8c95058ec21835dde3bb533d7db138c92d6d60d2ea812125a7638/pycopy-umqtt.robust-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "767640af5f1d4b18948ebfe1edcc1fd4", "sha256": "24d2971ed2973ac8a225b8f58bf1ace894498ea199c0fc395e19adaaaacd21b8" }, "downloads": -1, "filename": "pycopy-umqtt.robust-1.0.2.tar.gz", "has_sig": false, "md5_digest": "767640af5f1d4b18948ebfe1edcc1fd4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4996, "upload_time": "2019-08-13T05:29:06", "url": "https://files.pythonhosted.org/packages/02/3f/b905969eab5fba3850880ea4b7739c13f2c0210cae2042f320d283325415/pycopy-umqtt.robust-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "767640af5f1d4b18948ebfe1edcc1fd4", "sha256": "24d2971ed2973ac8a225b8f58bf1ace894498ea199c0fc395e19adaaaacd21b8" }, "downloads": -1, "filename": "pycopy-umqtt.robust-1.0.2.tar.gz", "has_sig": false, "md5_digest": "767640af5f1d4b18948ebfe1edcc1fd4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4996, "upload_time": "2019-08-13T05:29:06", "url": "https://files.pythonhosted.org/packages/02/3f/b905969eab5fba3850880ea4b7739c13f2c0210cae2042f320d283325415/pycopy-umqtt.robust-1.0.2.tar.gz" } ] }