Test 4: Use PUB/SUB pattern for flexible streaming
masterThis test demonstrates the PUB/SUB (Publisher/Subscriber) messaging pattern. Unlike the REQ/REP pattern used in Tests 1-3, PUB/SUB allows for more flexible start/stop behavior:
- REQ/REP: The receiver must be started before the sender. If the receiver restarts, the sender must also be restarted.
- PUB/SUB: Either the publisher or subscriber can be started first. If one is restarted, the other can continue running, and communication resumes automatically.
# On Mac (Subscriber)
workon py3cv3
cd imagezmq/tests
python test_4_pub.py
# On Mac (Publisher)
workon py3cv3
cd imagezmq/tests
python test_4_sub.py