EasyAPNS:有人尝试过处理大量通知吗?
我在我的应用程序和服务器中实现了 EasyAPNS,目前拥有一个包含 2000 多个注册设备的数据库。
今天,我尝试向所有这些设备发送通知,但脚本超时。我检查了代码(我知道应该早点完成),我发现它为每条消息打开一个连接。
基本上这个东西永远不会起作用并且会导致我的IP被禁止,对吧? Google 论坛中怎么可能没有提到这个问题?显然没有人尝试过这个带有大量通知的库——这是真的吗?或者我错过了什么?
I implemented EasyAPNS in my app and server and currently have a database with 2000+ registered devices.
Today I tried to send notifications to all of these devices and the script timed out. I checked the code (should've done it earlier, I know) and I discovered it opens a connection for each message.
Basically this thing will never work and will get my IP banned, right? How's it even possible that this problem is not mentioned anywhere in the Google group? Apparently nobody tried this library with a lot of notifications -- can this be real? Or am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终重写了很多将消息发送到 APNS 的代码。基本上,不必每次都循环打开和关闭连接的每条消息,只需每分钟从数据库中获取 N 条消息(可能限制为 100 条)并一次性发送它们。执行此操作,直到消息表为空(我为此使用了 cron 作业)。我还必须做更多的工作,因为我需要多个应用程序支持。
我不确定 EasyAPNS 的人在编写该库时在想什么。老实说,这根本没有帮助——如果我自己从头开始编写 APNS 代码会更好。如果有人需要帮助修改库,只需评论这篇文章。
I ended up rewriting a lot of the code that sends the messages to the APNS. Basically instead of looping through each message opening and closing the connection every time, just fetch N messages (probably the limit is 100) from the database every minute and send them in one shot. Do this until the messages table is empty (I used a cron job for this). I also had to do some more work because I needed multiple application support.
I'm not sure what the EasyAPNS guys were thinking when they wrote that library. Honestly, it didn't help at all -- it would have been better if I had written the APNS code from scratch on my own. Should anybody need help in modifying the library, just comment this post.
APNS 会阻止您的 IP。我同意 pt2ph8 的观点。
一个简单的问题,不过是问 pt2ph8。是否可以创建一个库来处理多个应用程序的 APNS?
APNS gets your IP blocked. I agree with pt2ph8.
One quick question, though to pt2ph8. Is it possible to create a library that will handle the APNS for multiple apps?