Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HijackTracker ¶
type HijackTracker struct {
// contains filtered or unexported fields
}
HijackTracker tracks connections that have been hijacked (e.g. WebSocket upgrades). http.Server.Shutdown does not close hijacked connections, so they must be tracked and closed explicitly during graceful shutdown.
Use Middleware as the outermost HTTP middleware to ensure hijacked connections are tracked and automatically deregistered when closed.
func (*HijackTracker) CloseAll ¶
func (t *HijackTracker) CloseAll() int
CloseAll closes all tracked hijacked connections and returns the number of connections that were closed.
func (*HijackTracker) Middleware ¶
func (t *HijackTracker) Middleware(next http.Handler) http.Handler
Middleware returns an HTTP middleware that wraps the ResponseWriter so that hijacked connections are tracked and automatically deregistered from the tracker when closed. This should be the outermost middleware in the chain.