[英]Swift - Using URLSessionStreamTask to keep my app in sync with Firebase DB data
I came across this link trying to figure out how to access the REST api of my firebase database and stream it to my app.我遇到这个链接试图弄清楚如何访问我的 firebase 数据库的 REST api 和 stream 它到我的应用程序。 I can get/send data manually, but for my app I can't use the firebase api (because it is an app clip), so I'm trying to do it with native tools and rest, but the issue I'm running into is getting the configuration right (per this info ) and actually parsing the incoming info and updating my app.
我可以手动获取/发送数据,但对于我的应用程序,我不能使用 firebase api(因为它是一个应用程序剪辑),所以我正在尝试使用本机工具和 rest,但我正在运行的问题into 正在正确配置(根据此信息)并实际解析传入信息并更新我的应用程序。 I'm so lost and could use some help just figuring out how to make the code in the sample work, especially since I'm using swift ui as well.
我很迷茫,可以使用一些帮助来弄清楚如何使示例中的代码工作,尤其是因为我也在使用 swift ui。
Any help is appreciated, thanks!任何帮助表示赞赏,谢谢!
Apparently App Clips do not allow sockets connections, so (while Google rewrites their sdk to comply), I migrated my database to Realtime Database (since it was a better fit for us usage-wise), and have been using standard rest for sending and getting data, and for the "listener" functionality I have been using IKEventSource that listens to server-side events and updates them accordingly in my app clip.显然 App Clips 不允许 sockets 连接,所以(虽然谷歌重写了他们的 sdk 以符合要求),我将我的数据库迁移到实时数据库(因为它更适合我们使用),并且一直使用标准 rest 发送和获取数据,对于“侦听器”功能,我一直在使用IKEventSource来侦听服务器端事件并在我的应用程序剪辑中相应地更新它们。 Seems to be a pretty good workaround so far.
到目前为止似乎是一个很好的解决方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.