Document the allowed concurrency on Upgrader and Dialer (#636)

* Document allowed concurrency on Dialer.
* Document allowed concurrency on Upgrader.
This commit is contained in:
Gary Burd 2021-12-16 11:07:50 -08:00 committed by GitHub
parent e8629af678
commit b4b5d887ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -48,6 +48,8 @@ func NewClient(netConn net.Conn, u *url.URL, requestHeader http.Header, readBufS
} }
// A Dialer contains options for connecting to WebSocket server. // A Dialer contains options for connecting to WebSocket server.
//
// It is safe to call Dialer's methods concurrently.
type Dialer struct { type Dialer struct {
// NetDial specifies the dial function for creating TCP connections. If // NetDial specifies the dial function for creating TCP connections. If
// NetDial is nil, net.Dial is used. // NetDial is nil, net.Dial is used.

View File

@ -23,6 +23,8 @@ func (e HandshakeError) Error() string { return e.message }
// Upgrader specifies parameters for upgrading an HTTP connection to a // Upgrader specifies parameters for upgrading an HTTP connection to a
// WebSocket connection. // WebSocket connection.
//
// It is safe to call Upgrader's methods concurrently.
type Upgrader struct { type Upgrader struct {
// HandshakeTimeout specifies the duration for the handshake to complete. // HandshakeTimeout specifies the duration for the handshake to complete.
HandshakeTimeout time.Duration HandshakeTimeout time.Duration