gozure

module
v0.0.0-...-fff5761 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2018 License: MIT

README

About

The library provides a Microsoft Azure Notification Hub Client for backend applications.

Installing

Using go get

$ go get github.com/onefootball/gozure/notihub

The package will be available under the following path:

$GOPATH/src/github.com/onefootball/gozure/notihub

Usage

package main

import (
    "fmt"
    "github.com/onefootball/gozure/notihub"
)

func main() {
    payload := []byte(`{"title": "Hello Hub!"}`)

    n, err := notihub.NewNotification(notihub.Template, payload)
    if err != nil {
        panic(err)
    }

    hub := notihub.NewNotificationHub("YOUR_DefaultFullSharedAccessSignature", "YOUR_HubPath")

    // broadcast push
    b, err := hub.Send(n, nil)
    if err != nil {
        panic(err)
    }

    fmt.Println("message successfully created:", string(b))

    // tag category push
    b, err = hub.Send(n, []string{"tag1", "tag2"})
    if err != nil {
        panic(err)
    }

    fmt.Println("message successfully created:", string(b))
}

License

See the LICENSE file for license rights and limitations (MIT).

Directories

Path Synopsis
Package notihub represents an http client for microsoft azure notification hub
Package notihub represents an http client for microsoft azure notification hub

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL