]> www.average.org Git - loctrkd.git/blobdiff - gps303/wsgateway.py
fix zmq subscription topics
[loctrkd.git] / gps303 / wsgateway.py
index 80926fbceb53b381d067eb2560d82cbeb2aa9aad..00770ebd88032c35f9b9e7172dba3c63233d7434 100644 (file)
@@ -255,22 +255,23 @@ def runserver(conf):
         while True:
             neededsubs = clients.subs()
             for imei in neededsubs - activesubs:
+                log.debug("topics: %s", [tpc.hex() for tpc in [topic(GPS_POSITIONING.PROTO, True, imei), topic(WIFI_POSITIONING.PROTO, False, imei)]])
                 zsub.setsockopt(
                     zmq.SUBSCRIBE,
-                    topic(GPS_POSITIONING.PROTO, True),
+                    topic(GPS_POSITIONING.PROTO, True, imei),
                 )
                 zsub.setsockopt(
                     zmq.SUBSCRIBE,
-                    topic(WIFI_POSITIONING.PROTO, False),
+                    topic(WIFI_POSITIONING.PROTO, False, imei),
                 )
             for imei in activesubs - neededsubs:
                 zsub.setsockopt(
                     zmq.UNSUBSCRIBE,
-                    topic(GPS_POSITIONING.PROTO, True),
+                    topic(GPS_POSITIONING.PROTO, True, imei),
                 )
                 zsub.setsockopt(
                     zmq.UNSUBSCRIBE,
-                    topic(WIFI_POSITIONING.PROTO, False),
+                    topic(WIFI_POSITIONING.PROTO, False, imei),
                 )
             activesubs = neededsubs
             log.debug("Subscribed to: %s", activesubs)
@@ -283,7 +284,10 @@ def runserver(conf):
                 if sk is zsub:
                     while True:
                         try:
-                            zmsg = Bcast(zsub.recv(zmq.NOBLOCK))
+                            buf = zsub.recv(zmq.NOBLOCK)
+                            zmsg = Bcast(buf)
+                            log.debug("zmq packet: %s", buf.hex())
+                            # zmsg = Bcast(zsub.recv(zmq.NOBLOCK))
                             msg = parse_message(zmsg.packet)
                             tosend.append(zmsg)
                             log.debug("Got %s", zmsg)