X-Git-Url: http://average.org/gitweb/?a=blobdiff_plain;f=gps303%2Fwsgateway.py;h=00770ebd88032c35f9b9e7172dba3c63233d7434;hb=d6c20543cf997f20cb72bf7380674bf012a5af88;hp=80926fbceb53b381d067eb2560d82cbeb2aa9aad;hpb=5e1e7a4d37a1e149d5e899dada7b55a863cd8e64;p=loctrkd.git diff --git a/gps303/wsgateway.py b/gps303/wsgateway.py index 80926fb..00770eb 100644 --- a/gps303/wsgateway.py +++ b/gps303/wsgateway.py @@ -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)