Documentation
¶
Overview ¶
Package nethttp exposes a net/http handler that upgrades incoming requests to WebSocket and hands the resulting connection to a server.Server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the http.Handler returned by NewHandler. It is also callable as a graceful shutter via Shutdown.
func NewHandler ¶
NewHandler returns a Handler that upgrades requests on opts.Path to WebSocket and serves them with srv.
type Options ¶
type Options struct {
// Path is the request path served by the handler. Defaults to
// "/arcp"; the handler returns 404 for any other request path
// when invoked through a parent mux that does not strip the
// prefix.
Path string
// AllowedHosts is the list of acceptable HTTP Host headers. The
// SDK default is the loopback set per spec §14 DNS-rebind
// protection.
AllowedHosts []string
// ReadLimit caps the inbound WebSocket frame size in bytes. Zero
// uses 1 MiB.
ReadLimit int64
// Subprotocols negotiated with the client. Empty selects none.
Subprotocols []string
// Origins allowed for browser clients. nil disables CORS.
Origins []string
// PingInterval drives WS-layer keepalives. Zero disables.
PingInterval time.Duration
}
Options configures the HTTP handler.
Click to show internal directories.
Click to hide internal directories.