Frontend: stream fires ping on connect
This is needed for Safari/Firefox to call onOpen
This commit is contained in:
parent
ff4c3f791c
commit
89f59a758d
4 changed files with 26 additions and 8 deletions
|
@ -126,13 +126,13 @@ def _handle_get_api_stream(handler, path_match, data):
|
|||
hass.bus.listen(MATCH_ALL, forward_events)
|
||||
|
||||
while True:
|
||||
write_message(STREAM_PING_PAYLOAD)
|
||||
|
||||
block.wait(STREAM_PING_INTERVAL)
|
||||
|
||||
if block.is_set():
|
||||
break
|
||||
|
||||
write_message(STREAM_PING_PAYLOAD)
|
||||
|
||||
if not gracefully_closed:
|
||||
_LOGGER.info("Found broken event stream to %s, cleaning up",
|
||||
handler.client_address[0])
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
""" DO NOT MODIFY. Auto-generated by build_frontend script """
|
||||
VERSION = "9d3e518a6c0516a3543fe6b364e4307b"
|
||||
VERSION = "b9bb73c7d937ff2219001668ea739134"
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -67,8 +67,23 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
var storeListenerMixIn = window.hass.storeListenerMixIn;
|
||||
|
||||
Polymer(Polymer.mixin({
|
||||
action: "display",
|
||||
isStreaming: false,
|
||||
|
||||
attached: function() {
|
||||
this.listenToStores(true);
|
||||
},
|
||||
|
||||
detached: function() {
|
||||
this.stopListeningToStores();
|
||||
},
|
||||
|
||||
streamStoreChanged: function(streamStore) {
|
||||
this.isStreaming = streamStore.isStreaming();
|
||||
},
|
||||
|
||||
submitClicked: function() {
|
||||
this.action = "configuring";
|
||||
|
@ -80,13 +95,16 @@
|
|||
|
||||
function() {
|
||||
this.action = 'display';
|
||||
window.hass.syncActions.sync();
|
||||
|
||||
if (!this.isStreaming) {
|
||||
window.hass.syncActions.start();
|
||||
}
|
||||
}.bind(this),
|
||||
|
||||
function() {
|
||||
this.action = 'display';
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
},
|
||||
}, storeListenerMixIn));
|
||||
</script>
|
||||
</polymer-element>
|
||||
|
|
Loading…
Add table
Reference in a new issue