From d886515b28bcd25655c9d48709dc0ce058b017eb Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 25 Nov 2021 10:13:32 +0800 Subject: [PATCH] bugfix --- appPublic/zmq_topic.py | 7 ++++++- doc/.zmq_topic.md.swp | Bin 12288 -> 0 bytes 2 files changed, 6 insertions(+), 1 deletion(-) delete mode 100644 doc/.zmq_topic.md.swp diff --git a/appPublic/zmq_topic.py b/appPublic/zmq_topic.py index a7c18b2..2e22f45 100644 --- a/appPublic/zmq_topic.py +++ b/appPublic/zmq_topic.py @@ -67,6 +67,7 @@ class TopicPublisher: self.url = "tcp://{}:{}".format(address, port) self.pub = self.context.socket(zmq.PUB) self.pub.connect(self.url) + time.sleep(0.5) def send(self, message): self.pub.send_multipart([self._topic, message.encode('utf-8')]) @@ -95,7 +96,11 @@ class TopicSubscriber: self.sub = self.context.socket(zmq.SUB) self.sub.connect(self.url) # subscribe to topic 'en' or 'jp' - self.sub.setsockopt(zmq.SUBSCRIBE, self._topic) + if isinstance(self.topic, []): + for t in self.topic: + self.sub.setsockopt(zmq.SUBSCRIBE, t.encode('utf-8')) + else: + self.sub.setsockopt(zmq.SUBSCRIBE, self.topic.encode('utf-8') def run(self): diff --git a/doc/.zmq_topic.md.swp b/doc/.zmq_topic.md.swp deleted file mode 100644 index 73d3c6480540070c5ac9ed96d4955d3b6ca40853..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2&2Jk;7>B1l04{Ao?WLS}iIMCGcVnB6q*i@Okf;!%Qe1?f)n>grwpZ*|cXs21 z&;vcR2M)c#9dY2?1OEVL;NC0r52&ExOQ`+Lcz5f#ttjfDqIx%a9PjMRJ2THaV=3_r z+aH{HkJhZN!1baK)9EIAgzbzxZMUY=8~00XDz}*Z><~18jf| zumLu}2A&cF4!(82{hSbg)-WM_|F8cC@Y@SQ+&n78FMz-~Z}1cN5qtrz zf-B%Numb|n2d{#k4-0Vv`~a?lufbQ~ORxuG@F8e}CGaeG1{?&xKQF|u;Ct{bxCSnR z&%qh61YQCsz(0qCxCL&2>);!36m%~2G{@_ zU;}L6sWecplc?7Pp!GN!`Qtp5-asG0+{}l{P5ogYQ~mToWeY9LK~6Q9tG};gq4uUs zx96%Bw_96VLew&;GFue`kWIC#EGHdrf84pSENV4PJ~~)HtV{vFx3X z_NvBJ8t4bog9 z(K><&kd&FJ7Uv@*rcC+T@;&#ZpZ{dO>Qof@(9X)sXf