fanout

package module
v0.0.0-...-50bbe81 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2015 License: MIT Imports: 1 Imported by: 0

README

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())
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fanout

type Fanout struct {
	// contains filtered or unexported fields
}

The Fanout struct is used for publishing messages to Fanout.io and is configured with a Fanout.io realm and associated key. SSL can either be enabled or disabled.

func NewFanout

func NewFanout(realm string, key []byte, ssl bool) *Fanout

Initialize with a specified realm, key, and a boolean indicating wther SSL should be enabled or disabled.

func (*Fanout) Publish

func (fanout *Fanout) Publish(channel string, data, id, prev_id string) error

Publish the specified data to the specified channel for the configured Fanout.io realm. Optionally provide an ID and previous ID to send along with the message.

type JsonObjectFormat

type JsonObjectFormat struct {
	// contains filtered or unexported fields
}

The JSON object format used for publishing messages to Fanout.io. The Value field represents the data to be published.

func (*JsonObjectFormat) Export

func (format *JsonObjectFormat) Export() interface{}

The method used to export the format data.

func (*JsonObjectFormat) Name

func (format *JsonObjectFormat) Name() string

The name of the format.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/dgrijalva/jwt-go
Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html See README.md for more info.
Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html See README.md for more info.
A useful example app.
_workspace/src/github.com/stretchr/testify/assert
A set of comprehensive testing tools for use with the normal Go testing system.
A set of comprehensive testing tools for use with the normal Go testing system.

Jump to

Keyboard shortcuts

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