i try to use SSE events from openhab for an interative sitemap for a native sailfis-os app with this two endpoints here:
POST /rest/sitemaps/events/subscribe
GET /rest/sitemaps/events/7a814d7c-e916-4966-934a-exampleid"
The first endpoint is working fine, i get a 200 with the subscription-id.
Test-setup: I call second endpoint to open event-stream and afterwards i change via openhab interface an item related to this sitemap, to check if an event is coming in.
When i try to use the second endpoint, i get nothing back in the event-stream. I also tried to call the endpoint manually, but there i receive nothing as well:
curl -N 'http://exampleip:8080/rest/sitemaps/events/7a814d7c-e916-4966-934a-exampleid'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:14 --:--:-- 0
I also tried it with sitemap and page-id as optional paramter:
sidenote: if i try to call the following endpoint, i receive a bunch of events every time:
curl -N 'http://exampleip:8080/rest/events'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0event: alive
data: {"type":"ALIVE","interval":10}
100 51 0 51 0 0 22 0 --:--:-- 0:00:02 --:--:-- 22event: message
but if i understood it right this endpoint should not be used to stream events for a sitemap, because there are all possible events and not the events for the sitemap only.
i also tried to use events from all sitemaps, but there are no events coming in - even if i change the state of items:
curl -N 'http://exampleip:8080/rest/sitemaps/events/bf665415-d941-4606-9b94-6598db977b2e/*'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:30:16 --:--:-- 0
Thanks Florian, i already tried this in this two combinations (with sitemap-Name + Id, with sitemap-name without id):
curl -N 'http://exampleip:8080/rest/sitemaps/events/7a814d7c-e916-4966-934a-exampleid?sitemap=Test'
curl -N 'http://exampleip:8080/rest/sitemaps/events/7a814d7c-e916-4966-934a-exampleid?sitemap=Test?pageid=0000'
result:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:03:57 --:--:-- 0
I tried it directly within cpp and with curl in the command line – same result. Do you have any ideas what i do wrong here? I also already asked LMM before, will try it again with the reference to the code implementation
curl -N -X GET "http://10.10.0.20:8080/rest/sitemaps/events/879aaeef-df22-410b-abc5-2e6dc0ca7897?sitemap=Test" -H "Accept: text/event-stream"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:33 --:--:-- 0
command for sub-page:
curl -N -X GET "http://10.10.0.20:8080/rest/sitemaps/events/879aaeef-df22-410b-abc5-2e6dc0ca7897?sitemap=Test&pageid=0000" -H "Accept: text/event-stream"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:37 --:--:-- 0
Unfortunately there are no error-logs within openhab. I also changed the logging from INFO to DEBUG with no success. Is it maybe my Openhab-version? I have installed currently 5.1.0. Or does any UI-Settings prevent the sitemaps-events from being generated (But should not be the case because the eventstreaming seems to work on iOS app as well).
I don’t think there is an error in openHAB. Basic UI, Android App & iOS App, all work fine with it.
BTW tip: You can also check the network tab of the browser dev tools when navigating Basic UI to watch the network requests made.
ok thank you i will try this as well. Yeah you’re right, the other apps are working, so it something i did wrong with the subscription. I will investigate further.