https://github.com/edganiukov/fcm
Golang client library for Firebase Cloud Messaging.
https://github.com/edganiukov/fcm
android fcm firebase-cloud-messaging go go-fcm golang push-notifications
Last synced: 3 months ago
JSON representation
Golang client library for Firebase Cloud Messaging.
- Host: GitHub
- URL: https://github.com/edganiukov/fcm
- Owner: edganiukov
- License: mit
- Created: 2016-06-14T09:24:05.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-03-23T10:21:50.000Z (about 7 years ago)
- Last Synced: 2024-11-17T12:16:13.252Z (over 1 year ago)
- Topics: android, fcm, firebase-cloud-messaging, go, go-fcm, golang, push-notifications
- Language: Go
- Homepage:
- Size: 32.2 KB
- Stars: 24
- Watchers: 3
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fcm
[](https://godoc.org/github.com/edganiukov/fcm)
[](https://travis-ci.org/edganiukov/fcm)
[](https://goreportcard.com/report/github.com/edganiukov/fcm)
Golang client library for Firebase Cloud Messaging. Implemented only [HTTP client](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream).
More information on [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/)
### Getting Started
-------------------
To install fcm, use `go get`:
```bash
go get github.com/edganiukov/fcm
```
or `dep`, add to the `Gopkg.toml` file dependency:
```toml
[[constraint]]
name = "github.com/edganiukov/fcm"
version = "0.3.0"
```
and then run:
```bash
dep ensure
```
### Sample Usage
----------------
Here is a simple example illustrating how to use FCM library:
```go
package main
import (
"github.com/edganiukov/fcm"
)
func main() {
// Create the message to be sent.
msg := &fcm.Message{
Token: "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.Fatal(err)
}
// Send the message and receive the response without retries.
response, err := client.Send(msg)
if err != nil {
/* ... */
}
/* ... */
}
```
#### TODO:
---------
- [ ] Retry only failed messages while multicast messaging.