diff --git a/example_test.go b/example_test.go index bc10209e417fc2625b7bd9af059c43f142218e5a..eef0e98dfb89fce1d993f540e1c2354dede15d8c 100644 --- a/example_test.go +++ b/example_test.go @@ -60,7 +60,9 @@ func ExampleDial() { c.Close(websocket.StatusNormalClosure, "") } -func ExampleWriteOnly() { +// This example shows how to correctly handle a WebSocket connection +// on which you will only write and do not expect to read data messages. +func Example_writeOnly() { fn := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { c, err := websocket.Accept(w, r, websocket.AcceptOptions{}) if err != nil { diff --git a/websocket.go b/websocket.go index 0c525b580bce4da9a3984b3244827c30b112c738..8d6088c8b0216b63fb028613e308d208102158b1 100644 --- a/websocket.go +++ b/websocket.go @@ -302,7 +302,7 @@ func (c *Conn) handleControl(ctx context.Context, h header) error { // You must read from the connection for close frames to be read. // If you do not expect any data messages from the peer, just call // Reader in a separate goroutine and close the connection with StatusPolicyViolation -// when it returns. See the WriteOnly example. +// when it returns. See the writeOnly example. // // Only one Reader may be open at a time. //