Skip to content

Commit

Permalink
Fix the problem of PAYLOAD SIZE being smaller than the actual availab…
Browse files Browse the repository at this point in the history
…le size
  • Loading branch information
Finb authored Apr 10, 2023
1 parent b63de9e commit dc8de84
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions apns/apns.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,6 @@ func Push(msg *PushMessage) error {
pl.Custom(strings.ToLower(k), fmt.Sprintf("%v", v))
}

// JSON payload maximum size of 4 KB (4096 bytes)
// https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns#2947607
plContentForJson, _ := pl.MarshalJSON()
if len(plContentForJson) > PayloadMaximum {
return fmt.Errorf("APNS Push Msg Payload too Large %d > 4096 bytes", len(plContentForJson))
}

resp, err := cli.Push(&apns2.Notification{
DeviceToken: msg.DeviceToken,
Topic: topic,
Expand Down

0 comments on commit dc8de84

Please sign in to comment.