2016-11-19 10:11
浏览 406

如何使用Golang FCM服务器发送FCM推送通知

i am doing ionic apps, using cordova fcm plugin i get the device token.Now i want send the push notification from go server.please help me how use go as the fcm server.I need some implementation example

图片转代码服务由CSDN问答提供 功能建议

我正在使用Cordova fcm插件执行离子应用程序,我获取了设备令牌。现在,我想从 go server。请帮助我将go用作fcm服务器。我需要一些实现示例

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doulubashang6936 2016-11-26 11:29
        package main
        import (
        const (
             serverKey = "YOUR-KEY"
        func main() {
      var NP fcm.NotificationPayload 
            data := map[string]string{
                "msg": "Hello World1",
                "sum": "Happy Day",
          ids := []string{
          xds := []string{
            c := fcm.NewFcmClient(serverKey)
            c.NewFcmRegIdsMsg(ids, data)
            status, err := c.Send()
            if err == nil {
            } else {
                fmt.Println(err)`enter code here`

    try this it works cool.

    点赞 打赏 评论
  • dtu1747 2016-11-24 09:12

    Your question is vague and you could have answered it by simply googling fcm golang or something around the line. Basically here's a list of libraries:

    It seems like most of them have some examples + docs. I'd generally speaking go with the most popular:

    Because you can inspire yourself from github issues and the docs are kind of decent:

    Small note, if any go library seems to lack examples/docs try running godocs in the folder or (even faster), try to first look for a GoDocs link on the github page.

    点赞 打赏 评论

相关推荐 更多相似问题