Skip to content

Commit

Permalink
Don't subscribe to Item events to reload model (#2949)
Browse files Browse the repository at this point in the history
Related to #2584 and
openhab/openhab-core#4466.

This avoids that the global SSE connection is always established, and
therefore reduces problems with the max parallel HTTP connections
limitation. The global SSE connection is now only established if the web
audio sink or the command Item are enabled.

Whilst this change potentially makes the UI not reload the model
automatically on change, practically the now removed mechanism might
haven't been really useful at all because the model is already reloaded
on Main UI start, and if SSE was not connected the moment an Item
changed the mechanism did not trigger.

Signed-off-by: Florian Hotze <dev@florianhotze.com>
  • Loading branch information
florian-h05 authored Dec 28, 2024
1 parent ad971dc commit 5d7f35a
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ export default {
},
methods: {
startEventSource () {
const topicItems = 'openhab/items/*/added,openhab/items/*/removed,openhab/items/*/updated'
const topicAudio = 'openhab/webaudio/playurl'
const commandItem = localStorage.getItem('openhab.ui:commandItem')
const topicCommand = `openhab/items/${commandItem || ''}/command`
let topics = topicItems
let topics = null
if (localStorage.getItem('openhab.ui:webaudio.enable') === 'enabled') {
topics = topicAudio
}
Expand All @@ -40,11 +39,6 @@ export default {
this.handleCommand(payload.value)
break
default:
if (event.topic.startsWith('openhab/items/')) {
console.info('Item SSE event received, reloading semantic model ...')
this.$store.dispatch('loadSemanticModel')
break
}
console.warn('Unhandled SSE event: ' + JSON.stringify(event))
}
})
Expand Down

0 comments on commit 5d7f35a

Please sign in to comment.