1 """ Watch for locevt and print them """
3 from datetime import datetime, timezone
4 from logging import getLogger
8 from .gps303proto import parse_message
9 from .zmsg import Bcast
11 log = getLogger("gps303/watch")
16 zsub = zctx.socket(zmq.SUB)
17 zsub.connect(conf.get("collector", "publishurl"))
18 zsub.setsockopt(zmq.SUBSCRIBE, b"")
22 zmsg = Bcast(zsub.recv())
23 msg = parse_message(zmsg.packet, zmsg.is_incoming)
24 print("I" if zmsg.is_incoming else "O", zmsg.imei, msg)
25 except KeyboardInterrupt:
29 if __name__.endswith("__main__"):
30 runserver(common.init(log))