sse

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package see helps you send Sever-Sent Event streams over HTTP.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadFormat = errors.New("can't have newline")
)

Functions

func SetHeaders

func SetHeaders(h http.Header)

SetHeaders adds the required SSE headers to the output Headers.

func Write

func Write(w io.Writer, m Message) (int, error)

Write writes the given SSE message to the io.Writer.

Types

type Message

type Message struct {
	Comment string
	Event   string
	ID      string
	Retry   time.Duration
	Data    interface{}
	JSON    bool
}

Message represents a message that can be sent over Server-Sent Events.

func (*Message) WriteTo

func (m *Message) WriteTo(w io.Writer) (int64, error)

WriteTo nominally implements io.WriteTo.

Jump to

Keyboard shortcuts

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