Documentation
¶
Overview ¶
Package sse provides experimental server-sent event helpers for streaming rendered partials.
Index ¶
- type EventName
- type HeaderKey
- type HeaderValue
- type Patch
- type Signal
- type Writer
- func (s *Writer) ApplyHeaders()
- func (s *Writer) Comment(comment string) error
- func (s *Writer) Error(err error) error
- func (s *Writer) Event(event EventName, data any) error
- func (s *Writer) EventID(id string, event EventName, data any) error
- func (s *Writer) Flush()
- func (s *Writer) PatchHTML(target string, html template.HTML) error
- func (s *Writer) PatchPartial(ctx context.Context, r *http.Request, target string, p *partial.Partial) error
- func (s *Writer) Retry(after time.Duration) error
- func (s *Writer) Signal(name string, value any) error
- func (s *Writer) Use(stages ...partial.RenderStage) *Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeaderValue ¶
type HeaderValue string
const ( ContentTypeEventStream HeaderValue = "text/event-stream" CacheControlNoCache HeaderValue = "no-cache" ConnectionKeepAlive HeaderValue = "keep-alive" XAccelBufferingNo HeaderValue = "no" )
func (HeaderValue) String ¶
func (v HeaderValue) String() string
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer streams server-sent events to one http.ResponseWriter.
Writer is bound to a single response stream and is not safe for concurrent writes unless the caller serializes access.
func NewWriter ¶
func NewWriter(w http.ResponseWriter) *Writer
func (*Writer) ApplyHeaders ¶
func (s *Writer) ApplyHeaders()
func (*Writer) PatchPartial ¶
Click to show internal directories.
Click to hide internal directories.