Commit 0c292f97 authored by Jiahang Chen's avatar Jiahang Chen
Browse files

add function to update broker token

parent f871a215
Pipeline #437871 passed with stages
in 52 seconds
......@@ -426,17 +426,21 @@ def receive():
threading.Thread(target=receive).start()
else:
self.broker = Broker(
auth_form="Username/Password",
username=" ",
password=self.__access_token,
host=BaseVariable.BROKER_HOST,
)
if self.broker is None:
# first time to build a broker instance
self.broker = Broker(
auth_form="Username/Password",
username=" ",
password=self.__access_token,
host=BaseVariable.BROKER_HOST,
)
threading.Thread(
target=self.broker.receive,
args=(self.__endpoint, self.__on_broker_callback),
).start()
threading.Thread(
target=self.broker.receive,
args=(self.__endpoint, self.__on_broker_callback),
).start()
else:
self.broker.update_token(self.access_token)
def __on_broker_callback(self, ch, method, properties, body):
"""Parses body (content of a S3I-B message) and delegates the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment