mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-04 21:15:17 -06:00
Fixes #1801 by working around the Apple bug. Refs home-assistant/frontend#10819. Requires core-2021.12.0b6 or newer. ## Summary When the app has been in the background for a while without executing, reset the WebSocket connection in the WebView when execution begins again. Also implements the new `theme-update` external bus command since it will log as an unhandled message. This likely means we're over-updating theme colors, but that is relatively cheap to do and doesn't cause harm. ## Any other notes This works around a bug in NSURLSession's WebSocket implementation -- which WKWebView moved to in iOS 15 -- where it cannot reliably detect network connectivity failures due to extended backgrounding. Eventually it'll get a "connection reset by peer" or other error, but in the meantime it reports itself as still connected, thus leaving our WebView thinking it's connected but anything sent isn't sent and nothing is received.