fcm

command module
v0.0.0-...-2226a78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2019 License: MIT Imports: 3 Imported by: 0

README

FCM

Firebase Cloud Messaging (FCM) Library with golang

License

The MIT License (MIT). Please see License File for more information.

Installation

go get github.com/OzqurYalcin/fcm

Usage

package main

import (
	"encoding/json"
	"fmt"

	fcm "github.com/OzqurYalcin/fcm/src"
)

func main() {
	api := &fcm.API{"api-key"}
	request := &fcm.Request{}
	request.To = ""           // Instance ID
	request.Priority = "high" // Priority (high,normal)
	request.Data = map[string]string{"msg": "Hello World"}
	request.Notification = fcm.Notification{Title: "Title", Body: "Body"}
	request.ContentAvailable = true
	response := api.Send(request)
	pretty, _ := json.MarshalIndent(response, " ", "\t")
	fmt.Println(string(pretty))
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL