field

package
v0.0.0-...-5d469e5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNotField = erorr.Error("httpsse: not field")
)

Variables

This section is empty.

Functions

func Copy

func Copy(namewriter io.Writer, valuewriter io.Writer, runescanner io.RuneScanner) (namewritten int64, valuewritten int64, err error)

Copy copies the 'field' as defined by the HTTP-SSE specification: https://html.spec.whatwg.org/multipage/server-sent-events.html

field         = 1*name-char [ colon [ space ] *any-char ] end-of-line

func WriteString

func WriteString(writer io.Writer, name string, value string) (int, error)

WriteString writes a 'field' as defined by the HTTP-SSE specification: https://html.spec.whatwg.org/multipage/server-sent-events.html

For example, this:

comment.WriteString(writer, "message", "Hello world!")

Would write this:

"message: Hello world!\n"

Also, for example, this:

comment.WriteString(writer, "do-it", "once\ntwice\nthrice\nfource")

Would write this:

"do-it: once\ndo-it: twice\ndo-it: thrice\ndo-it: fource\n"

I.e., this:

"do-it: once"   +"\n"+
"do-it: twice"  +"\n"+
"do-it: thrice" +"\n"+
"do-it: fource" +"\n"

Types

This section is empty.

Jump to

Keyboard shortcuts

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