轮询 (poll)
长连接 (socket or http: comet)
push notification (c2dm for android, apple notification server for
iPhone, 2者的原理是一样的:push server -> apn -> iPhone -> app installed in
iPhone
Poll: mobile app polls the server for new messagesperiodically
Advantages: easy to implement in CAP server side.
Disadvantage: mobile app has to send a http request to checklatest news periodically (e.g. send a request every 30 mins), it will killdevice battery.
Persistent TCP/IP: mobile app initiates along-lived mostly idle TCP/IP connection with the server and maintains it byoccasionally sending keepalive messages. Whenever there is something new on theserver, it sends a messages to the phone over the TCP connection.
Advantages: Fully real-time updates.
Disadvantages: Hard to implement a reliable service on bothmobile device and the server side.
C2DM (for Android)/ APNS (for iOS device): they areios and android official recommended push notification solution. message can bepushed to user even if mobile app is not running in device.
C2DM introduction: http://www.androidkit.com/cloud-to-device-messaging
push notification的方案(比较全)
http://www.zhishi5.com/jyxx/2012/0119/article_4019.html
android长连接的讨论
http://www.eoeandroid.com/
长连接有2种:
1. 基于socket
* socket也有麻烦,因为要知道封装那些消息头,
* 自己实现的socket的真正麻烦在于不容易穿透不同类型的网络
2. 基于http (comet)
* http的长连接没多少人用
* 即使是长连接,http也必须要client先发起请求,
Comet:基于 HTTP 长连接的“服务器推”技术
http://www.ibm.com/
pocket长连接与http长连接的比较
http://topic.csdn.net/u/
android是使用Smack,
smack 源码分析一(android上实现长连接)
http://wangqinghua123.iteye.
smack 源码分析- PacketReader (android上实现长连接)
http://wangqinghua123.iteye.
smack 源码分析- PacketWriter (android上实现长连接)
http://wangqinghua123.iteye.
参考文档:
iOS
偷窥iPhone Push Notification的幕后: http://blog.csdn.net/ydfok/article/details/5732137
再论iPhone Push Notification: http://blog.csdn.net/ydfok/article/details/5732153
当app目前正在运行并在前端,如何处理push notification: http://stackoverflow.com/questions/1554751/how-to-handle-push-notification-if-application-is-already-running
下面这篇文章的"authentication"部分提到了如何把device绑定到user account: http://wiki.remobjects.com/wiki/Adding_Push_Notifications_to_Your_iPhone_Applications_Using_RemObjects_SDK_%28Xcode_%28iOS%29%29
iPhone push notification详解(推荐)
http://blog.csdn.net/kmyhy/article/details/6688370
http://blog.csdn.net/kmyhy/article/details/6739584
http://blog.csdn.net/kmyhy/article/details/6739693
http://blog.csdn.net/kmyhy/article/details/6792855
浅析最烦人的手机消息推送设计模式: http://write.blog.csdn.net/postedit/7329542
iphone push notification 消息推送 : http://blog.csdn.net/linkai5696/article/details/6316929
浅谈iPhone 中Push 功能原理 推送通知
http://mobile.51cto.com/
解析iPhone Push Notification 消息推送 图文详细介绍
http://mobile.51cto.com/
iPhone: 在程序里设置Push
http://mobile.51cto.com/
iPhone: 基于HTTP长连接Server PUSH
http://mobile.51cto.com/
iPhone 搭建PHP版Push服务器 实例操作
http://mobile.51cto.com/
Android
Android notification 官方文档:
http://developer.android.com/guide/topics/ui/notifiers/index.html
http://developer.android.com/guide/topics/ui/notifiers/toasts.html
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
Android Push Notification推播機制系列文章: http://lp43.blogspot.com/2012/02/android-push-notification.html
Android使用asynctask来做notification listener的问题: http://stackoverflow.com/questions/6143131/how-to-wake-up-start-not-running-app-from-c2dm-listener-on-android
不使用c2dm的android push notification方案: http://hi.baidu.com/heagle018/blog/item/f299029d36883a7654fb9654.html