ServiceWorker实例与地理位置更新的预期比率 [英] Expected ratio of ServiceWorker instances to Geolocation Updates

查看:147
本文介绍了ServiceWorker实例与地理位置更新的预期比率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:我的Brotkrumen Web应用程序在同一位置有一个新版本。



最重要的设计/建议规格更改是现在TravelManager订阅客户特定。 TravelEvent必须包含预期的Client.id(TravelEvent.source.id)。这意味着UA必须监视和过滤每个客户端的GeoLocation更新。我还添加了新的演示功能,例如按下到达按钮时显示的Trip Summary。您也可以按地图旅行或重播,将旅程重播到谷歌地图上。如果旅程的最后一个和下一个地理位置更新都可以在地图窗口中看到,那么平滑的标记移动可以通过CSS转换实现。


$ b $ p

帮助背景GeoLocation起床,并帮助Web应用程序与原生应用程序竞争!

如果我的TravelManager解决方案设计有问题,请告诉我。泪水洞!!

原始问题:

一段时间以来,我一直在与W3C / IETF (以及任何其他参与者),ServiceWorkers是理想的平台,能够承载Ultimate Web Apps所需的后台地理位置功能,以便与原生应用程序在公平的竞争环境中展开竞争。这个关键点通常是ServiceWorkers寿命的短暂性质。我一直认为,立即杀死它们是疯狂的,大部分的实现似乎都是一致的。 (火狐在30secs上最具攻击性,请参阅错误即使在堆不管怎么说,为了证明我是对的,和杰克·阿奇博尔德之类的人很不对劲,我写了一个小小的 Web App 。 (有一个aaa_readme.txt)

现在需要一些工作来提供一个旅程摘要页面,并在Google地图上绘制旅程,但是我想你会得到的想法,最重要的是看到真实世界,服务工作者实例和地理定位更新之间的实际可证明的关系? (我想在欧洲人在八月失踪之前就把它弄出来了 - )

那么我在这里做了些什么愚蠢的事吗?
我想象一下,当我在回家的路上被长时间卡在灯光下时,我只得到一个新的服务工作者实例,而且位置更新无处可见。
我的编码技能是否可悲并且测试技能不存在?

如果不是,那么我不知道为什么Web应用程序不能满足这些合法的非常理想的用户需求。当然,我们会获得用户授权,权限和发现权,但让我们继续吧? TravelManagerPolyfill.js文件几乎全部是UA开发者必须做的!

问:我理解了ServiceWorker架构正确,并实施了ServiceWorker实例的一个有效启发式询问随着时间的推移?

解决方案

是的,示例代码最后证明服务工作者范例非常适合将大量的背景地理位置提供给Ultimate Web Apps。每个新位置更新的SW实例到期计时器的更新是SW寿命的关键。这是迄今为止电池最友好但功能丰富的解决方案,可用于Web应用程序的背景地理定位难题。注意:我建议每个客户端单独一个TravelManager实例(与POC不同例如)和Flex Box的样式。

让我们希望这被UA供应商尽快拿起!


EDIT: There is a new version of my Brotkrumen Web App in the same location.

Most important design/proposed-specification change is that TravelManager subscription should now be Client specific. The TravelEvent must contain the intended Client.id (TravelEvent.source.id). This means that the UA must monitor and filter GeoLocation updates per client. I have also added new demo functionality such as a Trip Summary that is displayed when you press the "Arrive" button. The trip can also be replayed onto Google Maps by pressing "Map Trip" or "Replay". If the last and next geolocation updates for the trip are both visible in the Map window then smooth Marker movement is achieved via CSS transitions.

PLEASE help Background GeoLocation get up and help Web Apps compete with Native Apps!

If there is something wrong with my TravelManager solution design then let me know. Tear holes in it!

Original Question:

For some time I've been arguing with W3C/IETF (and anyone else who'd engage) that ServiceWorkers are the ideal platform to host the Background Geolocation functionality that Ultimate Web Apps need in order to compete on a level playing field with Native Apps. The sticking point is usually the fleeting nature of a ServiceWorkers' lifespan. I have always argued that it would be madness to kill them immediately and most implementations seem to agree. (Firefox being the most aggressive at 30secs see Bug this behaviour prevails even with heaps of CPU/Memory)

Anyway, in order to prove that I am right, and the likes of Jake Archibald are very much mistaken, I wrote a little Web App. (There is a aaa_readme.txt)

Now it still needs a bit of work to provide a trip summary page and map the trip on Google maps but I think you'll get the idea and most importantly see the real world, actual, demonstrable relationship between Service Worker Instances and Geolocation updates? (I wanted to get it out before the Europeans disappeared for August :-)

So have I done something stupid here? Am I imagining that I only get a new Service worker instance when I'm stuck at the lights for an extended period on the way home and position updates are nowhere to be seen? Are my coding skills lamentable and testing skills non-existent?

If not, then I have no idea why Web Apps are not allowed to satisfy these legitimate and very desirable user requirements. Sure, we'll get user-empowerment, permissions, and discovery right but let's get on with it? The TravelManagerPolyfill.js file is nearly all UA developers have to do!

Q: Have I understood the ServiceWorker architecture correctly and implemented a valid heuristic interrogation of ServiceWorker instantiation over time?

解决方案

A: Yes, the example code demonstrates conclusively that the Service Worker paradigm is ideally suited to delivering the much vaunted Background Geolocation to Ultimate Web Apps. The renewal of the SW instance expiry timer for each new position update is key to SW longevity. This is by far the most battery friendly yet feature rich solution available to the Web App background geolocation conundrum.

Note: I recommend a separate TravelManager instance per client (unlike the POC example) and Flex Box styling.

Let's hope this gets picked up by UA suppliers ASAP!

这篇关于ServiceWorker实例与地理位置更新的预期比率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆