Skip to content

polydice/pulse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A SNS & SSE integration library written in Golang.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages