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 ¶
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