sseflow

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, r *http.Response) (*Client, error)

func (*Client) Close

func (cl *Client) Close() error

func (*Client) Listen

func (cl *Client) Listen(ctx context.Context) <-chan *Message

func (*Client) Start

func (cl *Client) Start()

type ErrClosed

type ErrClosed struct {
	Retry uint
	ID    string
}

func (*ErrClosed) Error

func (err *ErrClosed) Error() string

func (*ErrClosed) GetRetry

func (err *ErrClosed) GetRetry() time.Duration

type Message

type Message struct {
	Comment []string
	ID      *string
	Retry   uint
	Event   string
	Data    string
}

func (*Message) Write

func (msg *Message) Write(b []byte) (int, error)

func (*Message) WriteTo

func (msg *Message) WriteTo(w io.Writer) (n int64, _ error)

type Server

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

func Upgrade

func Upgrade(w http.ResponseWriter, r *http.Request) *Server

func (*Server) Close

func (srv *Server) Close() error

func (*Server) Deadline added in v0.0.2

func (srv *Server) Deadline() (deadline time.Time, ok bool)

func (*Server) Done added in v0.0.2

func (srv *Server) Done() <-chan struct{}

func (*Server) Err added in v0.0.2

func (srv *Server) Err() error

func (*Server) Push

func (srv *Server) Push(v ...*Message)

func (*Server) Value added in v0.0.2

func (srv *Server) Value(k any) any

Jump to

Keyboard shortcuts

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