Coccodrillo / apns

A Golang package for sending Apple Push Notifications and using the Feedback Service.
MIT License
433 stars 126 forks source link

Send many many push notifications #36

Open pjebs opened 9 years ago

pjebs commented 9 years ago

According to Apple Docs, they want you to send as many push notifications using the one connection. The documentation states that you can actually send the data to each push notification next to each other instead one at a time.

In fact the docs state that if you send many push notifications separately, it may interpret it as a DoS attack.

Is there any way to do this using your package?

pjebs commented 9 years ago

I guess what I'm trying to say is how cam I satisfy this recommendation from Apple:

You may establish multiple connections to the same gateway or to multiple gateway instances. If you need to send a large number of remote notifications, spread them out over connections to several different gateways. This improves performance compared to using a single connection: it lets you send the remote notifications faster, and it lets APNs deliver them faster.

Keep your connections with APNs open across multiple notifications; don’t repeatedly open and close connections. APNs treats rapid connection and disconnection as a denial-of-service attack. You should leave a connection open unless you know it will be idle for an extended period of time—for example, if you only send notifications to your users once a day it is ok to use a new connection each day.

pjebs commented 9 years ago

And also this https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3

The binary interface employs a plain TCP socket for binary content that is streaming in nature. For optimum performance, batch multiple notifications in a single transmission over the interface, either explicitly or using a TCP/IP Nagle algorithm. The format of notifications is shown in Figure 5-1.

0x7061 commented 9 years ago

+1 Can this lib send only one push through one connection?

vinceyuan commented 9 years ago

+1 for sending many push notification in one connection.

coder-han commented 8 years ago

how one connection sending many?