gorush/vendor/github.com/appleboy/go-fcm
Eduard Pelesh bf97ca59ec Added mutable_content option for Firebase (#364)
It is now possible to send `mutable_content` option to Firebase which gets forwarded as `mutable-content` option for APNS.

A link to official documentation is: https://firebase.google.com/docs/cloud-messaging/http-server-ref#mutable_content
2018-08-15 11:47:15 +08:00
..
LICENSE feat: check unused package (#232) 2017-06-01 02:52:01 -05:00
README.md Added mutable_content option for Firebase (#364) 2018-08-15 11:47:15 +08:00
client.go feat: check unused package (#232) 2017-06-01 02:52:01 -05:00
message.go Added mutable_content option for Firebase (#364) 2018-08-15 11:47:15 +08:00
option.go feat: check unused package (#232) 2017-06-01 02:52:01 -05:00
response.go support Device Group HTTP POST Request (#299) 2017-10-24 21:37:53 -05:00
retry.go feat: check unused package (#232) 2017-06-01 02:52:01 -05:00

README.md

go-fcm

GoDoc Build Status Go Report Card

This project was forked from github.com/edganiukov/fcm.

Golang client library for Firebase Cloud Messaging. Implemented only HTTP client.

More information on Firebase Cloud Messaging

Feature

  • Send messages to a topic
  • Send messages to a device list
  • Supports condition attribute (fcm only)

Getting Started

To install fcm, use go get:

go get github.com/appleboy/go-fcm

or govendor:

govendor fetch github.com/appleboy/go-fcm

or other tool for vendoring.

Sample Usage

Here is a simple example illustrating how to use FCM library:

package main

import (
	"log"

	"github.com/appleboy/go-fcm"
)

func main() {
	// Create the message to be sent.
	msg := &fcm.Message{
		To: "sample_device_token",
		Data: map[string]interface{}{
			"foo": "bar",
		},
	}

	// Create a FCM client to send the message.
	client, err := fcm.NewClient("sample_api_key")
	if err != nil {
		log.Fatalln(err)
	}

	// Send the message and receive the response without retries.
	response, err := client.Send(msg)
	if err != nil {
		log.Fatalln(err)
	}

	log.Printf("%#v\n", response)
}