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

package sse

import "github.com/cristalhq/sse"

Index

Package Files

errors.go resp.go sse.go ssetcp.go stream.go

Constants

const (
    ErrNotFlusher  = Error("sse: not an HTTP-flusher")
    ErrNotHijacker = Error("sse: not an HTTP-hijacker")
)

func LastEventID Uses

func LastEventID(r *http.Request) string

LastEventID returns a last ID known by user. If it's not presented - empty string will be returnes

type BinaryMarshaler Uses

type BinaryMarshaler interface {
    MarshalBinary() ([]byte, error)
}

type Error Uses

type Error string

func (Error) Error Uses

func (e Error) Error() string

type Stream Uses

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

func UpgradeHTTP Uses

func UpgradeHTTP(r *http.Request, w http.ResponseWriter) (*Stream, error)

func (*Stream) Close Uses

func (s *Stream) Close() error

Close sends close event with empth data.

func (*Stream) Flush Uses

func (s *Stream) Flush() error

func (*Stream) SetEvent Uses

func (s *Stream) SetEvent(event string) error

func (*Stream) SetID Uses

func (s *Stream) SetID(id int64) error

func (*Stream) SetRetry Uses

func (s *Stream) SetRetry(retry time.Duration) error

func (*Stream) WriteBinary Uses

func (s *Stream) WriteBinary(message BinaryMarshaler) error

func (*Stream) WriteBytes Uses

func (s *Stream) WriteBytes(data []byte) error

func (*Stream) WriteEvent Uses

func (s *Stream) WriteEvent(id int64, event string, data []byte) error

func (*Stream) WriteFloat Uses

func (s *Stream) WriteFloat(num float64) error

func (*Stream) WriteInt Uses

func (s *Stream) WriteInt(num int64) error

func (*Stream) WriteJSON Uses

func (s *Stream) WriteJSON(v interface{}) error

func (*Stream) WriteString Uses

func (s *Stream) WriteString(data string) error

func (*Stream) WriteText Uses

func (s *Stream) WriteText(message TextMarshaler) error

type TextMarshaler Uses

type TextMarshaler interface {
    MarshalText() ([]byte, error)
}

type Upgrader Uses

type Upgrader struct {
    Timeout time.Duration
}

func (Upgrader) Upgrade Uses

func (u Upgrader) Upgrade(conn io.ReadWriter) (*Stream, error)

func (Upgrader) UpgradeHTTP Uses

func (u Upgrader) UpgradeHTTP(r *http.Request, w http.ResponseWriter) (*Stream, error)

Package sse imports 7 packages (graph). Updated 2020-11-30. Refresh now. Tools for package owners.