Skip to content

Commit

Permalink
Model: Don't subscribe to Item events to reload
Browse files Browse the repository at this point in the history
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 committed Dec 28, 2024
1 parent 511b949 commit 86b04f1
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 86b04f1

Please sign in to comment.