Documentation ¶
Overview ¶
Package pushreceiver is Push Message Receiver library from FCM.
Index ¶
- Variables
- type Backoff
- type Client
- type ClientOption
- func WithBackoff(b *Backoff) ClientOption
- func WithCreds(creds *FCMCredentials) ClientOption
- func WithDialer(dialer *net.Dialer) ClientOption
- func WithGCMCheckin(checkin bool) ClientOption
- func WithHTTPClient(c httpClient) ClientOption
- func WithHeartbeatPeriod(period time.Duration) ClientOption
- func WithLogger(logger logger) ClientOption
- func WithReceivedPersistentID(ids []string) ClientOption
- func WithTLSConfig(c *tls.Config) ClientOption
- type ConnectedEvent
- type DisconnectedEvent
- type Event
- type FCMCredentials
- type Heartbeat
- type HeartbeatError
- type HeartbeatEvent
- type MessageEvent
- type RetryEvent
- type UnauthorizedError
- type UpdateCredentialsEvent
Constants ¶
This section is empty.
Variables ¶
var ErrFcmNotEnoughData = errors.New("data Enough from FCM")
ErrFcmNotEnoughData is error that data is not enough data from FCM.
var ErrGcmAuthorization = errors.New("GCM authorization error")
ErrGcmAuthorization is authorization error of GCM.
var ErrNotFoundInAppData = errors.New("key not found")
ErrNotFoundInAppData is error that key not found in app data.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff struct {
// contains filtered or unexported fields
}
Backoff with jitter sleep to prevent overloaded conditions during intervals https://www.awsarchitectureblog.com/2015/03/backoff.html
type Client ¶
type Client struct { Events chan Event // contains filtered or unexported fields }
Client is FCM Push receive client.
func New ¶
func New(senderID string, options ...ClientOption) *Client
New returns a new FCM push receive client instance.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption type
func WithGCMCheckin ¶
func WithGCMCheckin(checkin bool) ClientOption
WithGCMCheckin is gcmCheckin setter
func WithHTTPClient ¶
func WithHTTPClient(c httpClient) ClientOption
WithHTTPClient is http.Client setter
func WithHeartbeatPeriod ¶
func WithHeartbeatPeriod(period time.Duration) ClientOption
WithHeartbeatPeriod is Heartbeat period setter
func WithReceivedPersistentID ¶
func WithReceivedPersistentID(ids []string) ClientOption
WithReceivedPersistentID is received persistentId list setter
func WithTLSConfig ¶
func WithTLSConfig(c *tls.Config) ClientOption
WithTLSConfig is tls.Config setter
type ConnectedEvent ¶
type ConnectedEvent struct {
ServerTimestamp int64
}
ConnectedEvent is connection event.
type DisconnectedEvent ¶
type DisconnectedEvent struct {
ErrorObj error
}
DisconnectedEvent is disconnect event.
type FCMCredentials ¶
type FCMCredentials struct { AppID string `json:"appId"` AndroidID uint64 `json:"androidId"` SecurityToken uint64 `json:"securityToken"` Token string `json:"token"` PrivateKey []byte `json:"privateKey"` PublicKey []byte `json:"publicKey"` AuthSecret []byte `json:"authSecret"` }
FCMCredentials is Credentials for FCM
type Heartbeat ¶
type Heartbeat struct {
// contains filtered or unexported fields
}
Heartbeat sends signal for connection keep alive.
type HeartbeatError ¶
type HeartbeatError struct {
ErrorObj error
}
HeartbeatError is send heartbeat error.
type HeartbeatEvent ¶
HeartbeatEvent is send/received heartbeat event.
type MessageEvent ¶
type MessageEvent struct { PersistentID string `json:"persistentId"` From string `json:"from"` To string `json:"to"` TTL int32 `json:"ttl"` Sent int64 `json:"sent"` Data []byte `json:"data"` }
MessageEvent is receive message event.
type RetryEvent ¶
RetryEvent is disconnect event.
type UnauthorizedError ¶
type UnauthorizedError struct {
}UnauthorizedError is unauthorization error.
type UpdateCredentialsEvent ¶
type UpdateCredentialsEvent struct {
Credentials *FCMCredentials
}
UpdateCredentialsEvent is credentials update event.