sse: github.com/wtks/sse Index | Files

package sse

import "github.com/wtks/sse"

Index

Package Files

handler.go option.go processor.go utils.go

Variables

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

type Client Uses

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

func (*Client) GetConnectionID Uses

func (c *Client) GetConnectionID() ID

func (*Client) GetUserKey Uses

func (c *Client) GetUserKey() string

type ID Uses

type ID [16]byte

type Options Uses

type Options struct {
    NoXAccelBuffering  bool
    SendChanBufferSize uint
    UserAuthenticator  UserAuthenticator
}

func NewDefaultOptions Uses

func NewDefaultOptions() Options

type Streamer Uses

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

Streamer SSE Streamer

func NewStreamer Uses

func NewStreamer(options Options) *Streamer

func (*Streamer) Broadcast Uses

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

func (*Streamer) BroadcastJson Uses

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

func (*Streamer) ConnectionCount Uses

func (s *Streamer) ConnectionCount() int

func (*Streamer) Dispatcher Uses

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

func (*Streamer) Multicast Uses

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

func (*Streamer) MulticastJson Uses

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

func (*Streamer) NewClient Uses

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

func (*Streamer) ServeHTTP Uses

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

func (*Streamer) SetHTTPHeaders Uses

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

func (*Streamer) Start Uses

func (s *Streamer) Start()

func (*Streamer) Stop Uses

func (s *Streamer) Stop()

func (*Streamer) Unicast Uses

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

func (*Streamer) UnicastJson Uses

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

type UserAuthenticator Uses

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

Package sse imports 7 packages (graph). Updated 2018-12-03. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).