https://github.com/tinode/fcm
Basic implementation of FCM (firebase cloud messaging) in Go
https://github.com/tinode/fcm
fcm firebase-cloud-messaging
Last synced: 4 months ago
JSON representation
Basic implementation of FCM (firebase cloud messaging) in Go
- Host: GitHub
- URL: https://github.com/tinode/fcm
- Owner: tinode
- License: apache-2.0
- Created: 2016-10-02T18:30:39.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-02T08:01:50.000Z (about 7 years ago)
- Last Synced: 2025-05-10T20:01:45.720Z (5 months ago)
- Topics: fcm, firebase-cloud-messaging
- Language: Go
- Size: 15.6 KB
- Stars: 12
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golang FCM
Basic implementation of FCM (firebase cloud messaging) in Go. Only HTTP requests with JSON payload are supported.
This package uses legacy HTTP API (pre-v1 API).## Documentation
[https://godoc.org/github.com/tinode/fcm](https://godoc.org/github.com/tinode/fcm)
## Usage:
```
client := fcm.NewClient(your_fcm_api_key)message := &fcm.HttpMessage{...initialize your message...}
response := client.SendHttp(message)
```The `client` is safe to use from multiple go routines at the same time. The client maintains a pool of HTTP connections. It recycles them as needed. Do not recreate client for every request because it's wasteful.
`SendHttp` is a blocking call.Sample code: https://github.com/tinode/chat/blob/master/server/push/fcm/push_fcm.go
## Installation
```
go get github.com/tinode/fcm
```