Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it keep the connection? #40

Open
elgs opened this issue Dec 15, 2015 · 3 comments
Open

Does it keep the connection? #40

elgs opened this issue Dec 15, 2015 · 3 comments

Comments

@elgs
Copy link

elgs commented Dec 15, 2015

It seems apns disconnect from Apple's APNs server and establish a new one from the source code:

conn, err := net.Dial("tcp", client.Gateway)
if err != nil {
    return err
}
defer conn.Close()

tlsConn := tls.Client(conn, conf)
err = tlsConn.Handshake()
if err != nil {
    return err
}
defer tlsConn.Close()

While Apple says: (https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW1)

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.

So is it a problem to disconnect and reconnect each time? Is there an option to keep the connection? Thanks.

@gvgarven
Copy link

Yeah, there is no way to keep the connection.
The is a big problem.

@Marker451
Copy link

disconnect and reconnect each time
This is a big problem.
too slow

@wneo
Copy link

wneo commented Dec 21, 2016

Try this one: https://github.com/wneo/jlApns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants