func NewClient(config *Config, h MessageHandler) (Client, error) {
	switch {
	case config == nil:
		return nil, errors.New("config is nil")
	case h == nil:
		return nil, errors.New("message handler is nil")
	case config.APIKey == "":
		return nil, errors.New("empty api key")
	}

	useHTTPOnly := config.SenderID == ""

	// Create GCM HTTP client.
	httpc := newHTTPClient(
		config.APIKey,
		config.Debug,
		config.OmitInternalRetry,
		config.HTTPTimeout,
		config.HTTPTransport,
	)

	var xmppc xmppC
	var err error
	if !useHTTPOnly {
		// Create GCM XMPP client.
		xmppc, err = newXMPPClient(config.Sandbox, config.SenderID, config.APIKey, config.Debug, config.OmitInternalRetry)
		if err != nil {
			return nil, err
		}
	}

	// Construct GCM client.
	return newGCMClient(xmppc, httpc, config, h)
}
// NewClient creates a new GCM client for these credentials.
NewClient creates a new GCM client for these credentials.
// NewClient creates a new GCM client for these credentials .
func NewClient(config *Config, h MessageHandler) (Client, error) {
	switch {
	case config == nil:
		return nil, errors.New("config is nil")
	case h == nil:
		return nil, errors.New("message handler is nil")
	case config.APIKey == "":
		return nil, errors.New("empty api key")
	}
	useHTTPOnly := config.SenderID == ""
	httpc := newHTTPClient(
		config.APIKey,
		config.Debug,
		config.OmitInternalRetry,
		config.HTTPTimeout,
		config.HTTPTransport,
	)
	var xmppc xmppC
	var err error
	if !useHTTPOnly {
		xmppc, err = newXMPPClient(config.Sandbox, config.SenderID, config.APIKey, config.Debug, config.OmitInternalRetry)
		if err != nil {
			return nil, err
		}
	}
	return newGCMClient(xmppc, httpc, config, h)
}
func NewClient ( config * Config , h MessageHandler ) ( Client , error ) { switch { case config == nil : return nil , errors . New ( " " ) case h == nil : return nil , errors . New ( " " ) case config . APIKey == " " : return nil , errors . New ( " " ) } useHTTPOnly := config . SenderID == " " httpc := newHTTPClient ( config . APIKey , config . Debug , config . OmitInternalRetry , config . HTTPTimeout , config . HTTPTransport , ) var xmppc xmppC var err error if ! useHTTPOnly { xmppc , err = newXMPPClient ( config . Sandbox , config . SenderID , config . APIKey , config . Debug , config . OmitInternalRetry ) if err != nil { return nil , err } } return newGCMClient ( xmppc , httpc , config , h ) }
NewClient creates a new GCM client for these credentials.
NewClient creates a new GCM client for these credentials .
// Create GCM HTTP client. // Create GCM XMPP client. // Construct GCM client.