Skip to content

Commit

Permalink
Fix application restore subscription reconnect logic
Browse files Browse the repository at this point in the history
Fixes #19
  • Loading branch information
David Parker committed Mar 30, 2016
1 parent 1f1b1ef commit 1339b70
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='ibmiotf',
version="0.2.2",
version="0.2.3",
author='David Parker',
author_email='[email protected]',
package_dir={'': 'src'},
Expand Down
2 changes: 1 addition & 1 deletion src/ibmiotf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from pkg_resources import get_distribution
from encodings.base64_codec import base64_encode

__version__ = "0.2.2"
__version__ = "0.2.3"

class Message:
def __init__(self, data, timestamp=None):
Expand Down
4 changes: 2 additions & 2 deletions src/ibmiotf/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def on_connect(self, client, userdata, flags, rc):
# Restoring previous subscriptions
if len(self._subscriptions) > 0:
for subscription in self._subscriptions:
self.client.subscribe(subscriptions["topic"], qos=subscriptions["qos"])
self.client.subscribe(subscription["topic"], qos=subscription["qos"])
self.logger.debug("Restored %s previous subscriptions" % len(self._subscriptions))

elif rc == 5:
Expand Down Expand Up @@ -261,7 +261,7 @@ def subscribeToDeviceStatus(self, deviceType="+", deviceId="+"):
else:
topic = 'iot-2/type/%s/id/%s/mon' % (deviceType, deviceId)
self.client.subscribe(topic, qos=0)
self._subscriptions.append({"topic": topic, "qos": qos})
self._subscriptions.append({"topic": topic, "qos": 0})
return True


Expand Down

0 comments on commit 1339b70

Please sign in to comment.