Add note about reading the connection.

This commit is contained in:
Gary Burd 2014-07-07 09:33:43 -07:00
parent 0e7b5f878f
commit aef42a8ae6
1 changed files with 15 additions and 0 deletions

15
doc.go
View File

@ -102,4 +102,19 @@
// methods (NextReader, SetReadDeadline, ReadMessage). The Close and // methods (NextReader, SetReadDeadline, ReadMessage). The Close and
// WriteControl methods can be called concurrently with all other methods. // WriteControl methods can be called concurrently with all other methods.
// //
// Read is Required
//
// The application must read the connection to process ping and close messages
// sent from the peer. If the application is not otherwise interested in
// messages from the peer, then the application should start a goroutine to read
// and discard messages from the peer. A simple example is:
//
// func readLoop(c *websocket.Conn) {
// for {
// if _, _, err := c.NextReader(); err != nil {
// c.Close()
// break
// }
// }
// }
package websocket package websocket