# NGSI-Proxy Usage Documentation - ## Create eventsource: curl -X POST {{ngsiproxyurl}}/eventsource #### Sample create eventsource response: { "connection_id":"353529a0-281a-11ec-b25b-6d62e91d5158", "url":"{{ngsiproxyurl}}/eventsource/353529a0-281a-11ec-b25b-6d62e91d5158" } - ## Create callback: Use the previously generated **connection_id** to create the callback: curl -X POST '{{ngsiproxyurl}}/callbacks' \ --data-raw '{ "connection_id": "353529a0-281a-11ec-b25b-6d62e91d5158" }' #### Sample create callback response: { "callback_id":"40b18800-281a-11ec-b25b-6d62e91d5158", "url":"{{ngsiproxyurl}}/callbacks/40b18800-281a-11ec-b25b-6d62e91d5158" } - ## Consume callback: The callback to be notified by the context-broker through a subscription. Use the previously generated **callback_id** to create the callback: curl -X POST '{{ngsiproxyurl}}/callbacks/40b18800-281a-11ec-b25b-6d62e91d5158' \ --data-raw '{ "keyofpayloadcontent": "valueofpayloadcontent" }' - ## Sample EventSource: Use the url returned in "Create eventsource" const sse = new EventSource('{{ngsiproxyurl}}/eventsource/353529a0-281a-11ec-b25b-6d62e91d5158'); sse.addEventListener("notification", function(e) { console.log(JSON.parse(e.data)); }) This EventSource will fire everytime the callback is consumed.
NGSI-Proxy Usage Documentation
Create eventsource:
Sample create eventsource response:
Create callback:
Use the previously generated connection_id to create the
callback:
Sample create callback response:
Consume callback:
The callback to be notified by the context-broker through a
subscription. Use the previously generated callback_id to create
the callback:
Sample EventSource:
Use the url returned in "Create eventsource"
This EventSource will fire everytime the callback is consumed.