pulse

package module
v0.0.0-...-32f06d4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2013 License: MIT Imports: 8 Imported by: 0

README

Pulse

A AWS SNS(endpoint) and SSE(server side) integration library written in GO

##Install

go get github.com/polydice/pulse

##Features

  • Works out of the box, without any configuration
  • Auto confirm SNS subscribing
  • Auto parse SNS notification
  • Built-in http server for SNS request and SSE connection
  • Auto send notification to SSE client

##Usage

package main

import (
	"github.com/polydice/pulse"
)

func main() {
	pump := pulse.New(":8000")
	pump.Start(true) // Allow cross domain or not.
}

Then add /publish/any_event_name_you_want to your AWS SNS http endpoint. Now there is a SSE server on /subscribe/any_event_name_you_want, example usage:

var source = new EventSource('http://localhost:8000/subscribe/any_event_name_you_want');

// Create a callback for when a new message is received.
source.onmessage = function(e) {
  console.log(e.data)
};

##TODO

  • SNS signature verification
  • examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pump

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

func New

func New(port string) *Pump

func (*Pump) RegisterMessenger

func (self *Pump) RegisterMessenger(name string, msger *messenger.Messenger)

func (*Pump) Start

func (self *Pump) Start(allowCrossDomain bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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