Streaming Update Questions - Not updating on tablet after standby without refresh

Per the Feb 2015 update -

A connection can go stale in Chrome without any event handler being called. This happens when a device goes into standby. For computers this is rare but for phones this occurs quite often. This has been solved by sending a regular ping from the server. The frontend will assume the connection has gone stale when it hasn’t heard any communication for a while. Sending a ping will also help the server detect broken connections and clean them up.

I feel this issue still exists, when I power up HA via chrome on an android tablet. Has anyone ran into issue where they load HA on a tablet after it goes on standby, it doesn’t properly reflect the changes in state without a hard refresh?

1 Like

I see this in chrome on my PC all the time. For phones/tablets I am using iOS/Safari with no issues, haven’t tried chrome on a tablet.

If you read the streaming updates blog post. They said sending a ping will also help the server detect connections.

I’m trying to figure out how that would be done.

They’re actually saying that they do this. Meaning HA’s server portion does this. I don’t know if you can tune that ping manually, but I don’t have this problem unless I have HA set up as a web app and move it to the background. It usually manifests itself as my cameras gone missing.

But I think I have so much stuff that is streaming states and video to UI, my connection doesn’t really get a chance to go stale that often.

If you want a bit of fun some time, read some of the comments in the code… after talking in the cited post about not polling and instead streaming, @balloob links to the code section about it and in it I found this gem:

while True: try: # Somehow our queue.get sometimes takes too long to # be notified of arrival of data. Probably # because of our spawning on hub in other thread # hack. Because current goal is to get this out, # We just timeout every second because it will # return right away if qsize() > 0. # So yes, we're basically polling :( payload = to_write.get(timeout=1)

I see this all the time on my phone (Chrome pinned to Android Homescreen)

I think this is more about the way Chrome for Android suspends background tasks than HA though.

This has started happening after our transition to the new HTTP stack but I don’t know why. Especially because our frontend logic has a timeout built-in so that 60 seconds after the last message it will restart the connection: https://github.com/home-assistant/home-assistant-js/blob/master/src/modules/stream/actions.js#L27-L30

If anyone runs into this problem again and know how to use the Chrome device debugger for Android, please check the console to see if there are any error messages printed to the console

1 Like

I’ll try tonight when I return from my client’s site. Thanks for checking into this.

HI,

maybe this is obsolete already, but on my Hassio installation I don’t get the Streaming Updates in the left side bar. Do i need to enable anything in the configuration files for that to appear?

Thanks,
Marius