goose

package module
Version: v0.0.0-...-1f6ba96 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2015 License: MIT Imports: 7 Imported by: 0

README

Goose - Go Server-Sent Events GoDoc

Goose implements Server-Sent Events in Go.

See this example.

Licence

Copyright ©‎ 2014, Ian Kent (http://www.iankent.eu).

Released under MIT license, see LICENSE for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnableToHijackRequest is returned by AddReceiver if the type
	// conversion to http.Hijacker is unsuccessful
	ErrUnableToHijackRequest = errors.New("Unable to hijack request")
)

Functions

This section is empty.

Types

type EventReceiver

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

EventReceiver represents a hijacked HTTP connection

type EventStream

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

EventStream represents a collection of receivers

func NewEventStream

func NewEventStream() *EventStream

NewEventStream creates a new event stream

func (*EventStream) AddReceiver

func (es *EventStream) AddReceiver(w http.ResponseWriter) (*EventReceiver, error)

AddReceiver hijacks a http.ResponseWriter and attaches it to the event stream

func (*EventStream) Notify

func (es *EventStream) Notify(event string, bytes []byte)

Notify sends the event to all event stream receivers

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL