deadline

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deadline has a writer of a stream to a client, such as of server-sent events, which gives each write its own deadline, rather than the server's write timeout, which is for the whole response

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

Writer writes a stream to a client, with a deadline for each write, so a client which stops reading can't block it for longer than the timeout, and its Failed channel is closed when a write fails

func New

func New(w http.ResponseWriter, timeout time.Duration) (*Writer, error)

New returns a writer of a stream to a client, with the timeout of each write, and clears the server's deadline of the whole response, unless the response writer can't have its deadline set, when it's streamed to until the server's timeout

func (*Writer) Failed

func (w *Writer) Failed() <-chan struct{}

Failed returns a channel which is closed when a write fails, as the client stopped reading, or went away

func (*Writer) Flush

func (w *Writer) Flush()

Flush sends what's written to the client, by the deadline

func (*Writer) Unwrap

func (w *Writer) Unwrap() http.ResponseWriter

Unwrap returns the response writer, for a response controller

func (*Writer) Write

func (w *Writer) Write(data []byte) (int, error)

Write writes to the client, by the deadline

Jump to

Keyboard shortcuts

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