maddevsio / fcm Goto Github PK
View Code? Open in Web Editor NEWFirebase Cloud Messaging for application servers implemented using the Go programming language.
License: MIT License
Firebase Cloud Messaging for application servers implemented using the Go programming language.
License: MIT License
Errors in the 500-599 range (such as 500 or 503) indicate that there was an internal error in the FCM connection server while trying to process the request, or that the server is temporarily unavailable (for example, because of timeouts). Sender must retry later, honoring any Retry-After header included in the response. Application servers must implement exponential back-off.
Hello,
When I send a notification, I receive it but and when I click on it, it does not start my app when app is in background.
When I send using firebase console I can start my app even when app is in background.
I think I missed something on the payload to send or something.
Any help ?
Thank you
Hello,
Great library thanks.
For improvement : will you support channelids for android ?
Thanks
I'm trying to use this module with go gin, so just changed c
to cfm
in the test code:
func SendNotiPost(c *gin.Context) {
data := map[string]string{
"msg": "Hello World1",
"sum": "Happy Day",
}
cfcm := fcm.NewFCM("myServerKy")
token := myMobiletoken"
response, err := cfcm.Send(fcm.Message{
Data: data,
RegistrationIDs: []string{token},
ContentAvailable: true,
Priority: fcm.PriorityHigh,
Notification: fcm.Notification{
Title: "Hello",
Body: "World",
},
})
if err != nil {
log.Fatal(err)
}
fmt.Println("Status Code :", response.StatusCode)
fmt.Println("Success :", response.Success)
fmt.Println("Fail :", response.Fail)
fmt.Println("Canonical_ids :", response.CanonicalIDs)
fmt.Println("Topic MsgId :", response.MsgID)
c.JSON(200, gin.H{"message": "Notifications sent"})
}
But I get:
controller/firebase.go:39: cannot use "gopkg.in/maddevsio/fcm.v1".Message literal (type "gopkg.in/maddevsio/fcm.v1".Message) as type *"gopkg.in/maddevsio/fcm.v1".Message in argument to cfcm.Send
controller/firebase.go:47: cannot use "gopkg.in/maddevsio/fcm.v1".Notification literal (type "gopkg.in/maddevsio/fcm.v1".Notification) as type *"gopkg.in/maddevsio/fcm.v1".Notification in field value
What's wrong here? How to fix it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.