type Upgrader struct {
// HandshakeTimeout specifies the duration for the handshake to complete.
HandshakeTimeout time.Duration
// Input and output buffer sizes. If the buffer size is zero, then a
// default value of 4096 is used.
ReadBufferSize, WriteBufferSize int
// Subprotocols specifies the server's supported protocols. If Subprotocols
// is nil, then Upgrade does not negotiate a subprotocol.
Subprotocols []string
// Error specifies the function for generating HTTP error responses. If Error
// is nill, then http.Error is used to generate the HTTP response.
Error func(w http.ResponseWriter, r *http.Request, status int, reason error)
// CheckOrigin returns true if the request Origin header is acceptable.
// If CheckOrigin is nil, then no origin check is done.
CheckOrigin func(r *http.Request) bool
}
func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeader http.Header) (*Conn, error) { ... }