Skip to content

Commit

Permalink
websocket: add documentation to IsServerConn and IsClientConn
Browse files Browse the repository at this point in the history
Those function names are ambiguous. These functions don't check if a
client/server is connected but if the connection is client or server
side. Adding some documentation should avoid any mistake.

Change-Id: I0522e176d58c558fd880d49b980b0152b96823bc
Reviewed-on: https://go-review.googlesource.com/120146
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
gjolly authored and bradfitz committed Jun 21, 2018
1 parent db08ff0 commit afe8f62
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions websocket/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ func (ws *Conn) Close() error {
return err1
}

// IsClientConn reports whether ws is a client-side connection.
func (ws *Conn) IsClientConn() bool { return ws.request == nil }

// IsServerConn reports whether ws is a server-side connection.
func (ws *Conn) IsServerConn() bool { return ws.request != nil }

// LocalAddr returns the WebSocket Origin for the connection for client, or
Expand Down

0 comments on commit afe8f62

Please sign in to comment.