Use WebSockets to listen to status notifications
You can use WebSockets to listen to notifications about the status of monitored elements.
Steps
Example
For example, if you send the following commands:
{"context":"*"}
{"context":"host"}
You receive one notification on the channel with "subscription_id":0 listening to all elements and one notification the channel with "subscription_id":1 dedicated to of hosts elements. The creation of a host sends a notification on both channels. The creation of a router only sends a notification on the "subscription_id":0 channel.
>>>{"event":{"type":"create","element":"http://localhost:8082/7.2.1/elements/router/1733"},"subscription_id":0}
>>>{"event":{"type":"create","element":"http://localhost:8082/7.2.1/elements/host/1732"},"subscription_id":0}
>>>{"event":{"type":"create","element":"http://localhost:8082/7.2.1/elements/host/1732"},"subscription_id":1}
>>>{"event":{"type":"update","element":"http://localhost:8082/7.2.1/elements/admin_user/3"},"subscription_id":0}
>>>{"event":{"type":"update","element":"http://localhost:8082/7.2.1/elements/admin_user/3"},"subscription_id":0}