Skip to content

Commit

Permalink
[BasicUI] Fix SSE reconnection to the current page (#2280)
Browse files Browse the repository at this point in the history
After an error in the SSE connection, the event source is now
reconnected to the right sitemap page.

Fix one of both problems explained in #1757

Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo authored Jan 20, 2024
1 parent 2c70e19 commit 3a31e85
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions bundles/org.openhab.ui.basic/web-src/smarthome.js
Original file line number Diff line number Diff line change
Expand Up @@ -2955,9 +2955,7 @@
responseJSON,
subscribeLocation,
subscribeLocationArray,
sitemap,
subscriptionId,
page;
subscriptionId;

try {
responseJSON = JSON.parse(response.responseText);
Expand All @@ -2978,14 +2976,11 @@
subscribeLocationArray = subscribeLocation.split("/");
subscriptionId = subscribeLocationArray[subscribeLocationArray.length - 1];

sitemap = document.body.getAttribute("data-sitemap");
page = document.body.getAttribute("data-page-id");

smarthome.subscriptionId = subscriptionId;

initSubscription(subscribeLocation +
"?sitemap=" + sitemap +
"&pageid=" + page);
"?sitemap=" + smarthome.UI.sitemap +
"&pageid=" + smarthome.UI.page);
};

_t.subscriberError = function(xhr) {
Expand Down

0 comments on commit 3a31e85

Please sign in to comment.