Send messages to topics for android (#296)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
41
vendor/github.com/appleboy/go-fcm/README.md
generated
vendored
41
vendor/github.com/appleboy/go-fcm/README.md
generated
vendored
@@ -1,8 +1,8 @@
|
||||
# go-fcm
|
||||
|
||||
[](https://godoc.org/github.com/edganiukov/fcm)
|
||||
[](https://travis-ci.org/edganiukov/fcm)
|
||||
[](https://goreportcard.com/report/github.com/edganiukov/fcm)
|
||||
[](https://godoc.org/github.com/edganiukov/fcm)
|
||||
[](https://travis-ci.org/edganiukov/fcm)
|
||||
[](https://goreportcard.com/report/github.com/edganiukov/fcm)
|
||||
|
||||
This project was forked from [github.com/edganiukov/fcmfcm](https://github.com/edganiukov/fcm).
|
||||
|
||||
@@ -10,6 +10,12 @@ Golang client library for Firebase Cloud Messaging. Implemented only [HTTP clien
|
||||
|
||||
More information on [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/)
|
||||
|
||||
## Feature
|
||||
|
||||
* [x] Send messages to a topic
|
||||
* [x] Send messages to a device list
|
||||
* [x] Supports condition attribute (fcm only)
|
||||
|
||||
## Getting Started
|
||||
|
||||
To install fcm, use `go get`:
|
||||
@@ -34,31 +40,32 @@ Here is a simple example illustrating how to use FCM library:
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/edganiukov/fcm"
|
||||
"log"
|
||||
|
||||
"github.com/appleboy/go-fcm"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create the message to be sent.
|
||||
msg := &fcm.Message{
|
||||
Token: "sample_device_token",
|
||||
Data: map[string]interface{}{
|
||||
"foo": "bar",
|
||||
}
|
||||
}
|
||||
To: "sample_device_token",
|
||||
Data: map[string]interface{}{
|
||||
"foo": "bar",
|
||||
},
|
||||
}
|
||||
|
||||
// Create a FCM client to send the message.
|
||||
client := fcm.NewClient("sample_api_key")
|
||||
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)
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### TODO:
|
||||
---------
|
||||
- [ ] Retry only failed messages while multicast messaging.
|
||||
|
||||
Reference in New Issue
Block a user