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

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

问题描述

在同一位置有我的 Brotkrumen Web 应用程序的新版本.

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

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

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!

如果我的 TravelManager 解决方案设计有问题,请告诉我.撕破洞!

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

原始问题:

一段时间以来,我一直在与 W3C/IETF(以及其他任何参与其中的人)争论,ServiceWorkers 是托管 Ultimate Web Apps 所需的后台地理定位功能的理想平台,以便在公平的竞争环境中竞争与本机应用程序.症结通常是 ServiceWorker 生命周期的转瞬即逝.我一直认为立即杀死它们是疯狂的,大多数实现似乎都同意.(Firefox 在 30 秒时最激进,请参阅 Bug 这种行为即使在堆中也很普遍CPU/内存)

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)

总之,为了证明我是对的,还有Jake Archibald之类的大错特错,我写了一点网络应用.(有aaa_readme.txt)

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)

现在仍然需要一些工作来提供旅行摘要页面并在 Google 地图上绘制旅行地图,但我认为您会明白这一点,最重要的是看到 Service Worker 实例和地理位置更新?(我想在八月欧洲人消失之前把它弄出来:-)

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 :-)

所以我在这里做了一些愚蠢的事情吗?我是否在想象,当我在回家的路上长时间被困在灯光下并且无处可见位置更新时,我只会得到一个新的 Service Worker 实例?我的编码技能可悲,测试技能不存在吗?

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?

如果不是,那么我不知道为什么不允许 Web 应用程序满足这些合法且非常理想的用户要求.当然,我们将获得用户授权、权限和发现权,但让我们继续吗?TravelManagerPolyfill.js 文件几乎是 UA 开发人员必须所有

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!

问:我是否正确理解了 ServiceWorker 架构并随着时间的推移实现了对 ServiceWorker 实例化的有效启发式询问?

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

推荐答案

A:是的,示例代码最终证明了 Service Worker 范式非常适合将备受吹捧的后台地理定位提供给 Ultimate Web Apps.每次新位置更新更新 SW 实例到期计时器是 SW 寿命的关键.这是迄今为止可用于解决 Web 应用后台地理定位难题的最省电但功能最丰富的解决方案.

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.

注意:我建议每个客户端使用一个单独的 TravelManager 实例(与 POC 示例不同)和 Flex Box 样式.

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

希望 UA 供应商尽快接受这一点!

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

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

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