Google Cloud Messaging for application servers implemented using the Go programming language.

gcm Build StatusCoverage Status

The Android SDK provides a nice convenience library (com.google.android.gcm.server) that greatly simplifies the interaction between Java-based application servers and Google's GCM servers. However, Google has not provided much support for application servers implemented in languages other than Java, specifically those written in the Go programming language. The gcm package helps to fill in this gap, providing a simple interface for sending GCM messages and automatically retrying requests in case of service unavailability.

Documentation: http://godoc.org/github.com/Aorioli/gcm

Getting Started

To install gcm, use go get:

go get github.com/Aorioli/gcm

Import gcm with the following:

import "github.com/Aorioli/gcm"

Sample Usage

Here is a quick sample illustrating how to send a message to the GCM server:

package main

import (
	"fmt"
	"net/http"
	"time"

	"github.com/Aorioli/gcm"
)

func main() {
	// Create the message to be sent.
	data := map[string]interface{}{"score": "5x1", "time": "15:10"}
	regIDs := []string{"4", "8", "15", "16", "23", "42"}
	m := new(gcm.Message)
	m.RegistrationIDs = regIDs
	m.Data = data

	// Create a Sender to send the message.
	sender := gcm.NewSender("sample_api_key", 2, time.Minute)

	// Send the message and receive the response after at most two retries.
	response, err := sender.Send(m)
	if err != nil {
		fmt.Println("Failed to send message:", err)
		return
	}

	/* ... */
}

Contributing

Open up an issue describing the bug, enhancement or whatever so it's open for discussion.

Fork the repo, make your changes on a separate branch from master and create a pull request.

Owner
Similar Resources

Stack-oriented programming language

aiur Stack-oriented programming language TODO Operators If statements Loops Procedures Include statements Package manager Syntax Conditional conditio

May 20, 2022

Sync your bank transactions with google sheets using Open Banking APIs

Sync your bank transactions with google sheets using Open Banking APIs

Jul 22, 2022

Sync your bank transactions with google sheets using Open Banking APIs

this is a markdown version of the copy on the site landing page: https://youneedaspreadsheet.com You need a spreadsheet 📊 Get on top of your finances

Jul 22, 2022

Simple translation tool using google translation api.

Translator Simple translation tool using google translation api. To use it you have to provide a valid service account as json file with path in the e

Feb 1, 2022

Pulumi - Modern Infrastructure as Code. Any cloud, any language 🚀

Pulumi - Modern Infrastructure as Code. Any cloud, any language 🚀

Pulumi's Infrastructure as Code SDK is the easiest way to create and deploy cloud software that use containers, serverless functions, hosted services,

Dec 30, 2022

Go library for querying Source servers

go-steam go-steam is a Go library for querying Source servers. Requirements Go 1.1 or above Installation go get -u github.com/sostronk/go-steam To us

Oct 28, 2022

DiscSpam is the best free and open source tool to spam/raid Discord servers.

DiscSpam is the best free and open source tool to spam/raid Discord servers.

DiscSpam Fast, Free, Easy to use Discord.com raid tool Report Bug , Request Feature About The Project There are a few Discord raid tools on GitHub, ho

Dec 27, 2022

A compute service that lets you run code without provisioning or managing servers

AWS Lambda for Go Lambda is a compute service that lets you run code without provisioning or managing servers. Lambda runs your code on a high-availab

Oct 13, 2021

Trojan discord bot, used for grieving discord servers

Trojan discord bot, used for grieving discord servers

disc-TROJAN-go Trojan discord bot, used for grieving discord servers How Does It Work? disc-TROJAN-go is a discord bot with hidden features. At the ti

Feb 28, 2022
Correct the timestamp of photo/video of Google Photo from Google takeout

Correct Timestamp of Google Photo from Google Takeout Development Environment: Ubuntu 20.04 Go 1.17 Usage Require Go 1.16 or later to build. go build

Sep 9, 2022
Google Cloud Client Libraries for Go.

Google Cloud Client Libraries for Go Go packages for Google Cloud Platform services. import "cloud.google.com/go" To install the packages on your syst

Jan 1, 2023
Leave Discord servers using the folder names.

leavemealone ------------ Leave Discord servers using the folder names. Usage ----- 1. `export TOKEN="<token>"` 2. `go run . <folder_name>` 3. Chec

Feb 4, 2022
Instagram Messaging API GO SDK

Instagram Messaging API GO SDK Introduction Instabot, Instagram Messaging API GO SDK makes it easy to work with instagram messaging API. It uses Insta

Nov 13, 2022
A demonstration of the transactional outbox messaging pattern (+ Log Trailing) with Amazon DynamoDB (+ Streams) written in Go.
A demonstration of the transactional outbox messaging pattern (+ Log Trailing) with Amazon DynamoDB (+ Streams) written in Go.

Transactional Outbox Pattern in Amazon DynamoDB A demonstration of the transactional outbox messaging pattern (+ Log Trailing) with Amazon DynamoDB (+

Apr 12, 2022
A collection of cloud security icons :cloud::lock:
A collection of cloud security icons :cloud::lock:

Cloud Security Icons These icons are published under the extremely permissive Creative Commons Zero v1.0 Universal license. Downloads We provide all i

Jan 7, 2023
AWS SDK for the Go programming language.

AWS SDK for Go aws-sdk-go is the official AWS SDK for the Go programming language. Checkout our release notes for information about the latest bug fix

Dec 31, 2022
Simple Shopify API for the Go Programming Language

go-shopify Simple API made with go to make CRUD request to your Shopify Store. Installation go get github.com/rapito/go-shopify How-to-use Get Reques

Dec 7, 2022
Nextengine-sdk-go: the NextEngine SDK for the Go programming language

NextEngine SDK for Go nextengine-sdk-go is the NextEngine SDK for the Go programming language. Getting Started Install go get github.com/takaaki-s/nex

Dec 7, 2021
A GitHub action for the Go! programming language (by Francis McCabe, 2004)

Setup Go! (GitHub Action) This project is a GitHub action for the Go! programmin

Oct 22, 2022