Skip to content

Does it keep the connection? #40

@elgs

Description

@elgs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions