是否可以在 Google App Engine 应用程序中实现 iPhone 推送通知?
我正处于 iPhone 应用程序的规划阶段,正在考虑将 Google App Engine 用于我的服务器组件由于其可扩展性的特点。
推送通知使用二进制接口发送到 gateway.push.apple.com:2195
。
不过,服务器的 JRE 只允许使用以下标准类,其中不包括 Socket
类。可以使用 URLConnection
来执行此操作吗?
考虑到 Google App Engine 应用程序的限制,是否有办法实现推送通知?
我想避免使用第三方服务,例如 AppNotify 或 UrbanAirship(如果可能)。
I'm in the planning phase of an iPhone application and am considering using Google App Engine for my server component due to its scalability features.
Push notifications are sent using a binary interface to gateway.push.apple.com:2195
.
However, the JRE for the server is only allowed to use the following standard classes, which does not include the Socket
classes. Can URLConnection
be used somehow to do this?
Is there a way to implement push notifications given the restrictions on Google App Engine applications?
I'd like to avoid using a third-party service such as AppNotify or UrbanAirship if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
没有。 Google App Engine 禁止本机套接字连接。您要么需要使用第三方服务(如您提到的服务),要么拥有另一个专用服务器来发送通知。
编辑:请注意,GAE 对套接字和传出调用的限制不仅仅是库限制。 Google 服务器实际上会阻止所有出站网络连接;它们只允许通过 URL 获取服务器进行 HTTP 请求。
如果您愿意,可以给问题 1164:添加对 Apple 推送通知服务的支持加注星标。
Nope. Google App Engine forbids native socket connections. You either need to use a third party service (like the ones you mentioned) or have another dedicated server for sending notifications.
EDIT: Please note that the limitation of GAE on sockets and outgoing calls isn't a library limitation only. Google servers actually block all outbound network connections; they only allow HTTP requests through URL Fetching servers.
If you like, you can star Issue 1164: Add Support for Apple Push Notification Service.
现在,有了 Appengine 1.7.7 版,一切皆有可能!
Now with Appengine Release 1.7.7 its possible!
您使用第 3 方库 notnoop/java-apns。它很容易使用。您可能遇到的唯一问题是GAE上的线程限制
您可以参考这个答案:https:// /stackoverflow.com/a/24900789/474002
You use the 3rd-party library notnoop/java-apns. It is easy to use. The only problem you could meet is the thread limitation on the GAE
You could refer to this answer: https://stackoverflow.com/a/24900789/474002
这是绝对有可能的。查看 java-apns-gae。
它是一个开源 Java APNS 库,专门设计用于在 Google App Engine 上工作(和使用)。
It is absolutely possible. Check out java-apns-gae.
It's an open-source, Java APNS library that was specifically designed to work (and be used) on Google App Engine.
最近,Google 正式支持在 iOS 上发送推送通知。您可以查看此示例代码。
有关更多详细信息,请查看 Google 的 帖子。
Lately, Google officially supports to send push notification on iOS. You can take a look at this sample code.
For more detail, checkout this Google's post.