dashing

package module
v0.0.0-...-2a05fe4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2014 License: MIT Imports: 7 Imported by: 0

README

dashing-go

A Go port of shopify/dashing, built upon Martini.

Still under heavy construction!

Current Status
  • The /widget/:id endpoint is done. You can now post JSON data to individual widgets.
  • The /events endpoint (which emits Server-Sent Events) is done. Registered jobs can now transmit data to widget identifiers.
  • For an example of how to write jobs in dashing-go, please refer to the demo dashboard.

Credits

Much of the code is referenced from golang-sse-todo by @rwynn.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(j Job)

Register a job to be kicked off upon starting the server.

func Start

func Start()

Start all jobs and listen to requests.

Types

type Broker

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

A Broker broadcasts events to multiple clients.

func NewBroker

func NewBroker() *Broker

NewBroker creates a Broker instance.

func (*Broker) Start

func (b *Broker) Start()

Start managing client connections and event broadcasts.

type Event

type Event struct {
	ID     string
	Body   map[string]interface{}
	Target string
}

An Event contains the widget ID, a body of data, and an optional target (only "dashboard" for now).

type Job

type Job interface {
	Work(send chan *Event)
}

A Job does periodic work and sends events to a channel.

Jump to

Keyboard shortcuts

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