# README
GCM Library for Go

Provides the following functionality for Google Cloud Messaging:
- Sending messages via HTTP or XMPP.
- Receiving messages from XMPP.
Documentation: see godoc
Installation
$ go get github.com/kikinteractive/go-gcm
Status
This is a rework of go-gcm library. It has the following improvements:
- code refactored, HTTP and XMPP clients separated
- monitors XMPP connection with pings, redials when ping fails
- handles CONNECTION_DRAINING properly
- graceful close
- exponential backoff when sending a message
- circuit breaker for each provider
- improved logging with logrus
- ginkgo tests
- various govet/golint fixes
- automatic builds with Travis and coverage with Codecov
This library is in Beta. We will make an effort to support the library, but we reserve the right to make incompatible changes when necessary.
Feedback
Please read CONTRIBUTING and raise issues here in Github.
Limitations
Note that GCM limitations are not enforced by the library. Instead, all valid requests are sent to the server and a corresponding error is returned (Message Too Big, Device Message Rate Exceeded, etc).
# Functions
NewClient creates a new GCM client for this senderID.
# Constants
CCSAck is a positive acknowledge.
CCSControl is a CCS upstream control message.
CCSDraining is an upstream CSS message it wants to drain the current connection.
CCSNack is a negative acknowledge.
CCSReceipt is an upstream receipt message.
DefaultMaxBackoff is the default max delay for backoff.
DefaultMinBackoff is a default min delay for backoff.
DefaultPingInterval is a default interval between pings.
DefaultPingTimeout is a default time to wait for ping replies.
XMPPIQResult is a result for IQ query.
# Structs
CCSMessage is an XMPP message sent from CCS.
Config is a container for GCM client configuration data.
HTTPMessage defines a downstream GCM HTTP message.
HTTPResponse is the GCM connection server response to an HTTP downstream message.
HTTPResult represents the result of a single processed HTTP request.
Notification defines the notification payload of a GCM message.
XMPPMessage defines a downstream GCM XMPP message.
# Interfaces
Client defines an interface for the GCM client.
# Type aliases
Data defines the custom payload of a GCM message.
MessageHandler is the type for a function that handles a CCS message.