Skip to content

healthimation/go-pushy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-pushy

This package is a golang client for pushy.me.

Supported APIs

Usage

go get github.com/healthimation/go-pushy/pushy
import (
    "log"
    "time"

    "github.com/healthimation/go-pushy/pushy"
)

func main() {
    timeout := 5 * time.Second
    client := pushy.NewClient("my pushy api key", timeout)

    // push to devices
    tokens := []string{"device_token1", "device_token2"}
    data := map[string]string{"msg": "hello world!"}
    pushID, err := client.PushToDevices(context.Background(), tokens, data, nil) 
    if err != nil {
        log.Printf("Error pushing to devices: %s", err.Error())
    }

    // push to a topic
    topic := "current_events"
    pushID, err := client.PushToTopic(context.Background(), topic, data, nil)
    if err != nil {
        log.Printf("Error pushing to topic: %s", err.Error())
    }
}

About

a golang client for pushy.me

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages