One server sending push notifications to Android and iOS devices

前端 未结 3 1695
北海茫月
北海茫月 2021-02-15 15:54

Our organization has an Android app and an iOS app.

We want to start pushing notification to these apps.

Android has GCM. Apple has APNS.

But we want to

3条回答
  •  梦谈多话
    2021-02-15 16:25

    For APNS, Maybe you may consider this forked version of PyAPNS that has enhanced message support.
    https://github.com/jimhorng/PyAPNs
    which means it will catch error response for failure messages and resent the message which are discarded by APNS while sending between failure messages and receiving error response.

    Solution:

    • Non-blocking ssl socket connection to send notification without waiting for response.
    • A separate thread for constantly checking error-response from read connection.
    • A sent notification buffer used for re-sending notification that were sent after failed notification, or arbitrary connection close by apns. (Reference to non-blocking apns pull request by minorblend, enhanced message by hagino3000)

    Result:

    • Send notification at throughput of 1000/secs
    • In worse case of when 1st notification sent failed, error-response respond after 1 secs and 999 notification sent are discarded by APNS at the mean time, all discarded 999 notifications will be resent without loosing any of them. With the same logic, if notification resent failed, it will resent rest of resent notification after the failed one.

    For GCM, you may consider https://github.com/geeknam/python-gcm

    For generic wrapper that support both or more mobile provider: https://github.com/Redth/PushSharp

提交回复
热议问题