且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

来自服务器的iPhone实时通知,而无需使用Apple推送通知

更新时间:2022-11-03 13:50:13

如果应用程序正在运行,则可以打开从应用程序到服务器的http连接,并使服务器保持打开状态,并在需要时通过它推送数据.基本上,这就是 COMET 的工作方式.

If the app is running you can open an http connection from the app to the server and have the server hold it open, pushing data through it when you want. This is basically how COMET works.

这仅在您的应用程序运行时有效.如果即使用户已关闭应用程序也需要通知,那么Apple Push Notifications是您唯一的选择.

This will only work while your app is running. If you need the notification to happen even if the user has closed the app then Apple Push Notifications are your only option.