... | ... | @@ -227,7 +227,26 @@ The subscriber is created by connecting to the publisher named "the-publisher" l |
|
|
|
|
|
The same subscriber in Python:
|
|
|
```python
|
|
|
try:
|
|
|
# Connect to the app PubApp which hosts a publisher.
|
|
|
publisherApp = server.connect("PubApp")
|
|
|
|
|
|
# Create a subscriber to the application.
|
|
|
subscriber = cameopy.coms.Subscriber.create(publisherApp, "publisher")
|
|
|
|
|
|
# Initialize the subscriber.
|
|
|
subscriber.init()
|
|
|
|
|
|
# Receive data.
|
|
|
while True:
|
|
|
message = subscriber.receiveString()
|
|
|
if message:
|
|
|
print("Received", message)
|
|
|
else:
|
|
|
break
|
|
|
|
|
|
except cameopy.InitException:
|
|
|
print("Subscriber error")
|
|
|
```
|
|
|
|
|
|
As for the requester/responder no port was provided to define the publisher and subscriber. but only a name. Moreover the Cameo implementation provides a bit of **synchronization** with the number of subscribers which can be very useful.
|
... | ... | |