Browse Source

websocket: add documentation to IsServerConn and IsClientConn

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>
Gauthier Jolly 7 years ago
parent
commit
afe8f62b1d
1 changed files with 3 additions and 0 deletions
  1. 3 0
      websocket/websocket.go

+ 3 - 0
websocket/websocket.go

@@ -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