1976年贪婪的嘴唇,韩国少妇激三级做爰2023电影,久久久久久精品国产三级涨奶,妖精漫画在线观看免费漫画下拉式

蘋果通知推送服務(APNS)一些關鍵特性摘要
來源:易賢網 閱讀:1399 次 日期:2015-04-21 13:45:47
溫馨提示:易賢網小編為您整理了“蘋果通知推送服務(APNS)一些關鍵特性摘要”,方便廣大網友查閱!

前段時間,仔細研究了APNS的文檔,把一些關鍵的地方記錄了下來,弄懂這些對于理解APNS的規則,至關重要。

1. If APNs attempts to deliver a notification but the device is offline, the notification is stored for a limited period of time, and delivered to the device when it becomes available.

假如用戶手機不在線,可能沒有信號或者關機吧,APNs會存儲轉發,等用戶在線時再發送

2.Only one recent notification for a particular application is stored. If multiple notifications are sent while the device is offline, each new notification causes the prior notification to be discarded. This behavior of keeping only the newest notification is referred to as coalescing notifications.

如果用戶不在線,通知會合并,只會保留最新的一條。假如你給用戶發了兩條通知,但用戶反饋說,只收到了一條,那么很可能是用戶當時不在線,APNs的合并策略生效,只保留了最近一條

3.If the device remains offline for a long time, any notifications that were being stored for it are discarded

4.The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit.

這個很重要,payload,就是最后生成的那段Json,不得超過256字節。如果超過了,建議去掉一些不需要的參數,把alert,就是提示信息的字數減少

5.don’t repeatedly open and close connections. APNs treats rapid connection and disconnection as a denial-of-service attack.

6.If you send a notification that is accepted by APNs, nothing is returned.

發送成功的木有返回,只有發送失敗的才會返回

7.If you send a notification that is malformed or otherwise unintelligible, APNs returns an error-response packet and closes the connection. Any notifications that you sent after the malformed notification using the same connection are discarded, and must be resent.

這條非常重要,如果有error-response,那么這條之后的通知都需要重發。有很多開源的庫,在發蘋果通知時都沒有檢測error-response,如果你不小心用了,那么用戶很可能反饋“怎么沒有通知啊”

8.The notification identifier in the error response indicates the last notification that was successfully sent(實際情況不是,實際上返回的是出錯的那條通知的ID). Any notifications you sent after it have been discarded and must be resent.When you receive this status code, stop using this connection and open a new connection.

這是對上一條的補充,如果出錯了,需要關閉當前的連接,并且重新連接再發。error-response中返回的通知ID,可以幫助我們找出哪條出錯了,這樣就能知道哪些需要重發了

9.When a push notification cannot be delivered because the intended app does not exist on the device, the feedback service adds that device’s token to its list.

APNS的feedback service會返回那些已經卸載的設備的token--device_token。存儲這些token,下次就不用再給他們發了,可以節省點資源。需要注意的是:feedback的接口讀取一次,APNS就會清空它的列表,下次再讀取時,返回的就是這兩次讀取之間這段時間新產生的device_token。

只有把這些搞清楚,才方便我們理解蘋果推送的規則,知道自己推送上的一些不足之處。搞懂這些規則后,我自己封裝了個Java的類庫,已經開源并放到Github上了,下一篇文章奉上詳情。

更多信息請查看IT技術專欄

更多信息請查看技術文章
由于各方面情況的不斷調整與變化,易賢網提供的所有考試信息和咨詢回復僅供參考,敬請考生以權威部門公布的正式信息和咨詢為準!

2026國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
云南網警備案專用圖標
聯系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網
云南網警報警專用圖標
主站蜘蛛池模板: 广元市| 谢通门县| 上林县| 丘北县| 大关县| 日照市| 墨竹工卡县| 九龙县| 天镇县| 孙吴县| 肥城市| 元朗区| 阿克苏市| 那曲县| 贵德县| 五家渠市| 通渭县| 聂荣县| 大关县| 宁远县| 桂平市| 韶关市| 龙岩市| 定南县| 梁山县| 汾阳市| 格尔木市| 柯坪县| 海丰县| 泉州市| 安图县| 高邑县| 华蓥市| 响水县| 巴林左旗| 东港市| 三明市| 抚顺县| 两当县| 沂水县| 新宾|