1

I cannot host my own server for iOS push notification because the router is limited by Admin.

I want to learn from scratch so I don't want to use Parse or quickblox. Where and how can I know which PHP hosting plan support iOS push notification? Is there any free hosting available?

From Apple, the server need to allow inbound and outbound TCP packets over port 2196. I don't think regular hosting plan will list out this information.

http://developer.apple.com/library/ios/#technotes/tn2265/_index.html#//apple_ref/doc/uid/DTS40010376-CH1-TNTAG41

When I learnt Android push notification, I can easily find a hosting plan with CURL. iOS is a bit demanding.

4

1 回答 1

2

发送推送通知真正需要的端口是 2195。即使 TCP 数据包从您的服务器入站和出站,连接也只是出站的(您启动到 Apple 的连接)。大多数网络托管服务提供商对此不会有任何问题。

端口 2196 是反馈服务,您应该实现它,但它是可选的。相同的方式,通过端口 2196 的入站和出站 TCP 数据包,但您启动连接。

当设备通过发送设备令牌向您的服务器注册推送通知时,设备会启动连接,您可以选择如何将通知发送到服务器。如果您通过 HTTP(例如使用 NSURLConnection)发送它,任何基本的 Web 服务器都可以。

我只用了几个小时就实现了Easy APNS,它在我在 Dreamhost 的共享托管环境中运行良好。您只需要一个基本的 LAMP 堆栈(Linux、Apache、MySQL、PHP)和一份下载的 APNS 证书副本。Easy APNS 都是开源的,所以你可以看到他们是如何做到的。

于 2013-06-17T13:23:20.310 回答