From aef42a8ae63a680a8c5d4ca25b01ca57a97ffa5c Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Mon, 7 Jul 2014 09:33:43 -0700 Subject: [PATCH] Add note about reading the connection. --- doc.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc.go b/doc.go index 75c47e4..efde3dc 100644 --- a/doc.go +++ b/doc.go @@ -102,4 +102,19 @@ // methods (NextReader, SetReadDeadline, ReadMessage). The Close and // 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