FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
06-27-2022 10:22 AM
I'm trying to create a subscribtion to monitor nodes via javascript using the /event endpoint in the datalayer rest interface.
The problem is that the /automation/api/v2/events/subID GET requires authorization headers and that is not supported in any browser
https://developer.mozilla.org/en-US/docs/Web/API/EventSource
So i googled for a polyfill that suppors it and found this one;
https://github.com/Yaffle/EventSource
The problem is that using this never returns any messages. It does recieve data continously (the size increases) so so far it does work.
Does anyone have a working example using this?
/Andreas
Solved! Go to Solution.
06-28-2022 01:13 PM - last edited on 06-29-2022 08:11 AM by CodeShepherd
Hi Andreas,
can you replace
es.addEventListener("message", listener);
es.addEventListener("update", listener);
That should do the trick.
Best regards
Jochen
06-29-2022 03:12 PM