This example demonstrates how to implement a notification center to send and receive notifications.
- Install
coagent
(see Installation). - Start a NATS server (see Distributed).
Start a notification center in one terminal:
python examples/notification/notification.py
Then create a subscription via a proxy agent in another terminal:
coagent proxy -H type:Subscribe --stream --filter .content -d '{"user_id": "1"}'
Finally, send a notification to the center agent in a third terminal, and then observe the output in the second terminal:
coagent center:singleton -H type:Notify -d '{"user_id": "1", "notification": {"type": "created", "content": "Hello, world!"}}'