-
-
Save ilovelili/f42f1f825c0817d68806b7abf747d43b to your computer and use it in GitHub Desktop.
fcm send message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msg := &messaging.Message{ | |
APNS: &messaging.APNSConfig{ | |
Headers: map[string]string{ | |
"apns-priority": "10", | |
}, | |
Payload: &messaging.APNSPayload{ | |
Aps: &messaging.Aps{ | |
Alert: &messaging.ApsAlert{ | |
Title: category, | |
Body: body, | |
}, | |
// Badge: &badge, | |
}, | |
// question: do I put the payload here? | |
CustomData: map[string]interface{}{ | |
"type": "mention", | |
"commentId": "1", | |
"picture": "https://cdn.woodstock.club/logo.png", | |
"name": "min", | |
"comment": "you are cool", | |
}, | |
}, | |
}, | |
// question: or here? | |
Data: map[string]string{ | |
"type": "mention", | |
"commentId": "1", | |
"picture": "https://cdn.woodstock.club/logo.png", | |
"name": "min", | |
"comment": "you are cool", | |
}, | |
Token: device.DeviceID, | |
} | |
_, err := fcmClient.Send(context.Background(), msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment