sse

package module
v0.0.0-...-4baa293 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStreamerStopped = errors.New("this streamer stopped")
)

Functions

This section is empty.

Types

type Client

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

func (*Client) GetConnectionID

func (c *Client) GetConnectionID() ID

func (*Client) GetUserKey

func (c *Client) GetUserKey() string

type ID

type ID [16]byte

type Options

type Options struct {
	NoXAccelBuffering  bool
	SendChanBufferSize uint
	UserAuthenticator  UserAuthenticator
}

func NewDefaultOptions

func NewDefaultOptions() Options

type Streamer

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

Streamer SSE Streamer

func NewStreamer

func NewStreamer(options Options) *Streamer

func (*Streamer) Broadcast

func (s *Streamer) Broadcast(event string, data string) error

func (*Streamer) BroadcastJson

func (s *Streamer) BroadcastJson(event string, data interface{}) error

func (*Streamer) ConnectionCount

func (s *Streamer) ConnectionCount() int

func (*Streamer) Dispatcher

func (s *Streamer) Dispatcher(client *Client, rw http.ResponseWriter, r *http.Request)

func (*Streamer) Multicast

func (s *Streamer) Multicast(event string, data string, users []string) error

func (*Streamer) MulticastJson

func (s *Streamer) MulticastJson(event string, data interface{}, users []string) error

func (*Streamer) NewClient

func (s *Streamer) NewClient(userKey string) (*Client, error)

func (*Streamer) ServeHTTP

func (s *Streamer) ServeHTTP(rw http.ResponseWriter, r *http.Request)

func (*Streamer) SetHTTPHeaders

func (s *Streamer) SetHTTPHeaders(rw http.ResponseWriter)

func (*Streamer) Start

func (s *Streamer) Start()

func (*Streamer) Stop

func (s *Streamer) Stop()

func (*Streamer) Unicast

func (s *Streamer) Unicast(event string, data string, clientID ID) error

func (*Streamer) UnicastJson

func (s *Streamer) UnicastJson(event string, data interface{}, clientID ID) error

type UserAuthenticator

type UserAuthenticator func(r *http.Request) (userKey string, err error)

Jump to

Keyboard shortcuts

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