Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Coccodrillo/apns
/ functions
Functions
32 in github.com/Coccodrillo/apns
⨍
Functions
32
◇
Types & classes
8
↓ 5 callers
Method
PayloadJSON
PayloadJSON returns the current payload in JSON format.
push_notification.go:128
↓ 4 callers
Method
AddPayload
AddPayload sets the "aps" payload section of the request. It also has a hack described within to deal with specific zero values.
push_notification.go:97
↓ 4 callers
Function
NewPushNotification
NewPushNotification creates and returns a PushNotification structure. It also initializes the pseudo-random identifier.
push_notification.go:87
↓ 4 callers
Method
ToBytes
ToBytes returns a byte array of the complete PushNotification struct. This array is what should be transmitted to the APN Service.
push_notification.go:140
↓ 4 callers
Function
mockPayload
Create a new Payload that specifies simple text, a badge counter, and a custom notification sound.
push_notification_test.go:9
↓ 3 callers
Method
Get
Get returns the value of a payload key, if it exists.
push_notification.go:118
↓ 2 callers
Method
ConnectAndWrite
(resp *PushNotificationResponse, payload []byte)
client_mock.go:9
↓ 2 callers
Method
Send
(pn *PushNotification)
client_mock.go:13
↓ 2 callers
Method
Set
Set defines the value of a payload key.
push_notification.go:123
↓ 1 callers
Method
ConnectAndWrite
ConnectAndWrite establishes the connection to Apple and handles the transmission of your push notification, as well as waiting for a reply. In lieu o
client.go:93
↓ 1 callers
Function
NewAlertDictionary
NewAlertDictionary creates and returns an AlertDictionary structure.
push_notification.go:71
↓ 1 callers
Function
NewFeedbackResponse
NewFeedbackResponse creates and returns a FeedbackResponse structure.
feedback.go:31
↓ 1 callers
Function
NewPayload
NewPayload creates and returns a Payload structure.
push_notification.go:51
↓ 1 callers
Function
loop
Writes binary data to the client in the same manner as the Apple service would. [4 bytes, 2 bytes, 32 bytes] = 38 bytes total
mock_feedback_server.go:38
↓ 1 callers
Function
mockAlertDictionary
Create a new AlertDictionary. Apple recommends you not use the more complex alert style unless absolutely necessary.
push_notification_test.go:27
↓ 1 callers
Function
mockZeroBadgePayload
See the commentary in push_notification.go for information on why we're testing a badge of value 0.
push_notification_test.go:19
Function
BareClient
BareClient can be used to set the contents of your certificate and key blocks manually.
client.go:39
Method
ConnectAndWrite
(resp *PushNotificationResponse, payload []byte)
client.go:15
Method
ListenForFeedback
ListenForFeedback connects to the Apple Feedback Service and checks for device tokens. Feedback consists of device tokens that should not be sent to
feedback.go:42
Function
NewClient
NewClient assumes you'll be passing in paths that point to your certificate and key.
client.go:49
Function
NewPushNotificationResponse
NewPushNotificationResponse creates and returns a new PushNotificationResponse structure; it defaults to being unsuccessful at first.
push_notification_response.go:32
Method
PayloadString
PayloadString returns the current payload in string format.
push_notification.go:133
Method
Send
(pn *PushNotification)
client.go:16
Method
Send
Send connects to the APN service and sends your push notification. Remember that if the submission is successful, Apple won't reply.
client.go:59
Function
StartMockFeedbackServer
StartMockFeedbackServer spins up a simple stand-in for the Apple feedback service that can be used for testing purposes. Doesn't handle many errors, e
mock_feedback_server.go:16
Function
TestAlertDictionary
(t *testing.T)
push_notification_test.go:60
Function
TestBasicAlert
(t *testing.T)
push_notification_test.go:43
Function
TestCustomParameters
(t *testing.T)
push_notification_test.go:79
Function
TestLegacyConstants
These identifiers were changed to resolve golint violations. However, it's possible that legacy code may rely on them. This will help avoid springing
legacy_test.go:11
Function
TestMockClientConnectAndWrite
(t *testing.T)
client_mock_test.go:10
Function
TestMockClientSend
(t *testing.T)
client_mock_test.go:18
Function
TestZeroBadgeChangesToNegativeOne
(t *testing.T)
push_notification_test.go:104