简体   繁体   English

如何将解析频道与我们的API同步以正确提供推送通知

[英]How to sync Parse channels with our API to serve push notifications correctly

We use Parse to handle push notifications for our mobile apps, and we´re having a hard time figuring out how we can make sure that user notification preferences saved on our database are in sync with channels on Parse. 我们使用Parse处理我们的移动应用程序的推送通知,而且我们很难确定如何确保数据库中保存的用户通知首选项与Parse上的频道同步。

We developed a soccer scores app, where users follow their favorite teams to get push notifications when those teams score. 我们开发了一个足球比分应用程序,用户可以在其中跟随自己喜欢的球队得分,并在这些球队得分时获得推送通知。 We save those teams in both our database (in order to serve our API) and in parse, and most of the time that´s fine, but some times, something will get written on one side and not in the other, causing obvious issues with push notifications. 我们将这些团队保存在我们的数据库中(以便提供我们的API)和解析中,在大多数情况下都可以,但是有时候,某些方面会写在一侧而不是另一侧,从而导致明显的问题与推送通知。 So we are looking for a way of syncing the information, and we´re wondering: what´sa good way of approaching this problem? 因此,我们正在寻找一种同步信息的方法,并且我们想知道:什么是解决此问题的好方法?

Thanks in advance. 提前致谢。

Webhooks. Webhooks。 No idea what your own server looks like, but I'm sure you can add a webhook there. 不知道您自己的服务器是什么样的,但是我敢肯定您可以在其中添加一个Webhook。 But you could absolutely put that in the before save trigger for Installation objects. 但是您绝对可以将它放在Installation对象的before save触发器中。 If the channels key is dirty, trigger a the save on your own server. 如果通道键不干净,请在您自己的服务器上触发保存。 Then, only ever update the parse installation's channels when you want to update both. 然后,仅当要同时更新解析安装的通道时,才更新它们。

Vice versa if you've got the equivalent of a before save trigger on your own server. 反之亦然,如果您在自己的服务器上具有与保存前触发器相同的功能,则相反。 Or just only update this via a singular cloud function that updates your own db + the parse db. 或者仅通过单个云函数来更新此函数,该函数会更新您自己的数据库+分析数据库。

The before save trigger in parse sounds like the simplest and most reliable without knowing your server setup, though. 但是,在不了解服务器设置的情况下,解析之前的保存触发听起来是最简单,最可靠的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM