8000 GitHub - fanout/go-fanout: Fanout.io library for Go.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

fanout/go-fanout

Repository files navigation

go-fanout

Author: Konstantin Bokarius kon@fanout.io

A Go convenience library for publishing messages to Fanout.io using the EPCP protocol.

License

go-fanout is offered under the MIT license. See the LICENSE file.

Installation

go get github.com/fanout/go-fanout

go-fanout requires jwt-go 2.2.0 and go-pubcontrol 1.0.1. To ensure that the correct version of both of these dependencies are installed use godeps:

go get github.com/tools/godep
cd $GOPATH/src/github.com/fanout/go-fanout
$GOPATH/bin/godep restore

Usage

package main

import "github.com/fanout/go-fanout"
import "encoding/base64"

func main() {
    // Decode the base64 encoded key:
    decodedKey, err := base64.StdEncoding.DecodeString("<key>")
    if err != nil {
        panic("Failed to base64 decode the key")
    }

    // Pass true as the 3rd parameter for SSL or false for non-SSL:
    fo := fanout.NewFanout("<realm>", decodedKey, true)

    // Publish to the Fanout.io realm:
    err = fo.Publish("<channel>", "Test publish!", "", "")
    if err != nil {
        panic("Publish failed with: " + err.Error())
    }
}

About

Fanout.io library for Go.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0