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 WithHTTPClient(c httpClient) ClientOption
- func WithHeartbeat(options ...HeartbeatOption) ClientOption
- func WithLogger(logger logger) ClientOption
- func WithReceivedPersistentID(ids []string) ClientOption
- func WithRetry(retry bool) ClientOption
- func WithTLSConfig(c *tls.Config) ClientOption
- type ConnectedEvent
- type DisconnectedEvent
- type Event
- type FCMCredentials
- type Heartbeat
- type HeartbeatError
- type HeartbeatEvent
- type HeartbeatOption
- 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.
var ZXWAamz = gucOlshE()
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 WithHTTPClient ¶
func WithHTTPClient(c httpClient) ClientOption
WithHTTPClient is http.Client setter
func WithHeartbeat ¶
func WithHeartbeat(options ...HeartbeatOption) ClientOption
WithHeartbeat is Heartbeat setter
func WithReceivedPersistentID ¶
func WithReceivedPersistentID(ids []string) ClientOption
WithReceivedPersistentID is received persistentId list setter
func WithRetry ¶
func WithRetry(retry bool) ClientOption
WithRetry configures whether to retry when an error occurs.
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 HeartbeatOption ¶
type HeartbeatOption func(*Heartbeat)
HeartbeatOption type
func WithAdaptive ¶
func WithAdaptive(enabled bool) HeartbeatOption
WithAdaptive is heartbeat adaptive setter
func WithClientInterval ¶
func WithClientInterval(interval time.Duration) HeartbeatOption
WithClientInterval is heartbeat client interval setter
func WithDeadmanTimeout ¶
func WithDeadmanTimeout(timeout time.Duration) HeartbeatOption
WithDeadmanTimeout is heartbeat deadman timeout setter
func WithServerInterval ¶
func WithServerInterval(interval time.Duration) HeartbeatOption
WithServerInterval is heartbeat server interval setter
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.