Belchertown - PWA re-connect for Websocket

46 views
Skip to first unread message

Brice Ruth

unread,
Feb 17, 2020, 2:54:18 PM2/17/20
to weewx...@googlegroups.com
Good afternoon -

I've noticed that, on the iPhone, when I launch my PWS site from the homescreen, using the previously created icon (thank you!) - the websocket doesn't "reconnect" if you switch away and go back after a while. Doing some research, it seems that at some point, Apple modified homescreen launched apps to "save state" - which ... doesn't re-execute any JS automatically, seemingly. I did find a pattern to work around this here https://stackoverflow.com/a/56944455 and I've locally applied this on the version I'm running (I don't think I'm on the beta?). I basically did a minor refactor of the code that's tied to click/restart-interval, and used that to tie to the visibilitychanged event that seems to get triggered.

Limited testing seems to indicate that this works. Any concerns with me pushing up a PR for this? Anything else I should be aware of?

Thanks!

Brice Ruth, FCD
Software Engineer, Madison WI

Pat

unread,
Feb 17, 2020, 3:05:42 PM2/17/20
to weewx-user
PR's are welcome on the Belchertown skin! Please pull against the development branch and I'll check it out

Brice Ruth

unread,
Feb 17, 2020, 3:13:37 PM2/17/20
to weewx...@googlegroups.com
Roger that.

Brice Ruth, FCD
Software Engineer, Madison WI

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/54c9bfde-cefc-4073-b741-003726ca9d5f%40googlegroups.com.

Brice Ruth

unread,
Feb 17, 2020, 3:26:46 PM2/17/20
to weewx...@googlegroups.com

Brice Ruth, FCD
Software Engineer, Madison WI

Brice Ruth

unread,
Feb 17, 2020, 3:39:23 PM2/17/20
to weewx...@googlegroups.com

Brice Ruth, FCD
Software Engineer, Madison WI

Brice Ruth

unread,
Feb 17, 2020, 6:35:39 PM2/17/20
to weewx...@googlegroups.com
I pushed up a different approach - lemme know what you think.

Brice Ruth, FCD
Software Engineer, Madison WI

Reply all
Reply to author
Forward
0 new messages