def run(self): try: headers = [('selfId', ''), ('token', '')] topic = TopicClient.start_instance('127.0.0.1', 9443, headers) TopicClient.get_instance().setHeaders("", "") TopicClient.get_instance().set_callback(self.on_connected); topic.start() except KeyboardInterrupt: thread.exit()
def run(self): try: self_id = str(uuid.uuid4()) print("self id: " + self_id) headers = [('selfId', self_id), ('token', '')] topic = TopicClient.start_instance('127.0.0.1', 9443, headers) TopicClient.get_instance().setHeaders(self_id, "") TopicClient.get_instance().set_callback(self.on_connected) topic.start() except KeyboardInterrupt: exit() except ConnectionRefusedError: print("connection error: ")