为 APNS 推送服务器提供新电子邮件通知的建议
您将如何实现一个 APNS 服务器来检查新电子邮件并在检测到新电子邮件时向 iPhone 发送推送通知?我在建筑层面上想知道更多。为了简单起见,假设我们正在为 gmail 构建一个推送服务器。我看到的挑战是:
如何持续轮询 Gmail,以查找可能数以万计的唯一电子邮件帐户中的新邮件? gmail 是否允许通过一组 IP 进行此操作?
Gmail 有 IMAP 和收件箱提要。为了检测是否有新邮件到达,您是否需要记住每个帐户收到(或推送)的最后一封电子邮件?
这种连续轮询所需的 CPU 周期和带宽是否能让 EC2 或 RackSpace 等云解决方案经济实惠?
您如何以安全的方式处理身份验证和授权?例如,我曾经在 iPhone 上使用过 gTalk 客户端,该客户端有推送通知,当我下次从 Web 界面登录时,Gmail 会警告我,我的帐户是从不寻常的 IP 访问的。有办法避免这种情况吗?您会将用户的凭据存储在服务器上吗? OAuth 令牌?
我应该提到,这是为了满足我个人的好奇心,但它也可能是学习 Erlang 编程的一个有趣的项目。
对此的任何见解将不胜感激。
How would you implement an APNS server that checks for new email and sends a push notification to an iPhone when one is detected? I am wondering more at an architectural level. For the sake of simplicity, let's say we're building a push server for gmail. The challenges that I can see are:
How do you continuously poll Gmail for potentially tens of thousands of unique email accounts for new mail? Would gmail even allow this from a single set of IPs?
Gmail has an IMAP and Inbox feed. In order to detect if a new piece of mail has arrived, would you need to remember the last email that was received (or pushed) for each account?
Would the CPU cycles and bandwidth required for this continuous polling make a cloud solution such as EC2 or RackSpace affordable?
How do you handle authentication and authorization in a secure fashion? For example, I once used a gTalk client on my iPhone which had push notifications and Gmail warned me the next time that I logged in from the web interface that my account was accessed from an unusual IP. Is there a way to avoid this? Would you store the user's credentials on the server? An OAuth token?
I should mention that this is to please my personal curiosity but it might also be an interesting project for learning to program in Erlang.
Any insight on this would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要检查一下:
http://code.google.com/apis/gmail/
You might want to check this:
http://code.google.com/apis/gmail/