# README
go-push-receiver
A library to subscribe to GCM/FCM and receive notifications.
This library was developed inspired by push-receiver (https://github.com/MatthieuLemoine/push-receiver/).
Build
- install protoc
brew install protobuf
- build
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
$ protoc -I=proto --go_out=pb/mcs proto/mcs.proto
$ protoc -I=proto --go_out=pb/checkin proto/checkin.proto
$ protoc -I=proto --go_out=pb/checkin proto/android_checkin.proto
$ go build
License
MIT License
proto file is licensed by is The Chromium Authors. (BSD-style license) (copied it from https://chromium.googlesource.com/chromium/chromium/+/trunk/google_apis/gcm/protocol/)
# Functions
New returns a new FCM push receive client instance.
NewBackoff creates Backoff instance.
WithAdaptive is heartbeat adaptive setter.
WithBackoff is Backoff setter.
WithClientInterval is heartbeat client interval setter.
WithCreds is credentials setter.
WithDeadmanTimeout is heartbeat deadman timeout setter.
WithDialer is net.Dialer setter.
WithHeartbeat is Heartbeat setter.
WithHTTPClient is http.Client setter.
WithLogger is logger setter.
WithReceivedPersistentID is received persistentId list setter.
WithRetry configures whether to retry when an error occurs.
WithServerInterval is heartbeat server interval setter.
WithTLSConfig is tls.Config setter.
# Variables
ErrFcmNotEnoughData is error that data is not enough data from FCM.
ErrGcmAuthorization is authorization error of GCM.
ErrNotFoundInAppData is error that key not found in app data.
# Structs
Backoff with jitter sleep to prevent overloaded conditions during intervals https://www.awsarchitectureblog.com/2015/03/backoff.html.
Client is FCM Push receive client.
ConnectedEvent is connection event.
DisconnectedEvent is disconnect event.
FCMCredentials is Credentials for FCM.
Heartbeat sends signal for connection keep alive.
HeartbeatError is send heartbeat error.
HeartbeatEvent is send/received heartbeat event.
MessageEvent is receive message event.
RetryEvent is disconnect event.
UnauthorizedError is unauthorization error.
UpdateCredentialsEvent is credentials update event.
# Interfaces
Event type.