Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is a pattern-based HTTP muxer, based on top of bmizerany/pat, adding support for dynamic registration and deregistration of handlers. When a handler is added or removed, the underlying pat mux is swapped out with a new one.
Adding and removing handlers is expensive: each of those calls will create a new mux underneath. These operations are not expected to be frequently occurring.
func (*Mux) AddClient ¶
func (m *Mux) AddClient()
AddClient tells the mux there's another client that should keep it alive.
func (*Mux) AddHandler ¶
AddHandler adds an http.Handler for the given method and pattern. AddHandler returns an error if there already exists a handler for the method and pattern.
This is safe to call concurrently with m.ServeHTTP and m.RemoveHandler.
func (*Mux) ClientDone ¶
func (m *Mux) ClientDone()
ClientDone indicates that a client has finished and no longer needs the mux.
func (*Mux) RemoveHandler ¶
RemoveHandler removes the http.Handler for the given method and pattern, if any. If there is no handler registered with the method and pattern, this is a no-op.
This is safe to call concurrently with m.ServeHTTP and m.AddHandler.