forked from Coccodrillo/apns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.go
More file actions
31 lines (26 loc) · 1.08 KB
/
Copy pathclient.go
File metadata and controls
31 lines (26 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package apns
// Client is an APNS client.
type Client interface {
// ConnectAndWrite(resp *PushNotificationResponse, payload []byte) (err error)
// Send will initiate a send of the specified Push Notification, and return
// a response
Send(pn *PushNotification) (resp *PushNotificationResponse)
}
// UseHTTP2API informs BareClient and NewClient which communication API to use
var UseHTTP2API = true
// BareClient will create a new Client that will use the base64 certificate and
// key to conduct it's transations
func BareClient(gateway, certificateBase64, keyBase64 string) (c Client, err error) {
if UseHTTP2API {
return BareHTTP2Client(gateway, certificateBase64, keyBase64)
}
return BareGatewayClient(gateway, certificateBase64, keyBase64), nil
}
// NewClient will create a new Client that will use the certificate and key at
// the specifies for it's transactions
func NewClient(gateway, certificateFile, keyFile string) (c Client, err error) {
if UseHTTP2API {
return NewHTTP2Client(gateway, certificateFile, keyFile)
}
return NewGatewayClient(gateway, certificateFile, keyFile)
}