CrimsonBear: Glucose data on pebble. PebbleKit JS timers suspended on iOS

Hi. I’m developing CrimsonBear ( GitHub - dabear/CrimsonBearPebbleWatchFace · GitHub ), a Pebble CGM watchface. Its PebbleKit JS phone companion polls Nightscout—a glucose data source—roughly every five minutes and sends new readings to the watch.

I instrumented an adaptive setTimeout and an independent 30-second setInterval. With Developer Connection enabled, both fired within 3–8 ms. With it disabled and the Pebble app backgrounded on iOS:

  • setTimeout fired 259 seconds late.
  • setInterval fired 477 seconds late.
  • Both resumed at essentially the same moment.
  • No fetch, AppMessage, connectivity, or companion-restart errors occurred.

This suggests to me that iOS suspends the entire PKJS runtime while the Pebble app is backgrounded.

Has anyone found a reliable way to perform five-minute background polling from PebbleKit JS on iOS, or must it be driven by watch-originated AppMessages or native iOS background scheduling?

The watch has a fallback that requests fresh data from the phone when updates stop for some additional time. It works, but I’d prefer not to rely on frequent watch-originated AppMessages because of their potential battery impact. I currently get about 9–10 days of watch runtime.

You’ve verified that it actually impacts the battery?