Improve control message handler doc

Fixes #338
This commit is contained in:
Gary Burd 2018-01-31 17:52:56 -08:00 committed by GitHub
parent 91f589db02
commit 4ac909741d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

15
conn.go
View File

@ -1051,8 +1051,9 @@ func (c *Conn) CloseHandler() func(code int, text string) error {
// if the close message is empty. The default close handler sends a close // if the close message is empty. The default close handler sends a close
// message back to the peer. // message back to the peer.
// //
// The application must read the connection to process close messages as // The handler function is called from the NextReader, ReadMessage and message
// described in the section on Control Messages above. // reader Read methods. The application must read the connection to process
// close messages as described in the section on Control Messages above.
// //
// The connection read methods return a CloseError when a close message is // The connection read methods return a CloseError when a close message is
// received. Most applications should handle close messages as part of their // received. Most applications should handle close messages as part of their
@ -1079,8 +1080,9 @@ func (c *Conn) PingHandler() func(appData string) error {
// The appData argument to h is the PING message application data. The default // The appData argument to h is the PING message application data. The default
// ping handler sends a pong to the peer. // ping handler sends a pong to the peer.
// //
// The application must read the connection to process ping messages as // The handler function is called from the NextReader, ReadMessage and message
// described in the section on Control Messages above. // reader Read methods. The application must read the connection to process
// ping messages as described in the section on Control Messages above.
func (c *Conn) SetPingHandler(h func(appData string) error) { func (c *Conn) SetPingHandler(h func(appData string) error) {
if h == nil { if h == nil {
h = func(message string) error { h = func(message string) error {
@ -1105,8 +1107,9 @@ func (c *Conn) PongHandler() func(appData string) error {
// The appData argument to h is the PONG message application data. The default // The appData argument to h is the PONG message application data. The default
// pong handler does nothing. // pong handler does nothing.
// //
// The application must read the connection to process ping messages as // The handler function is called from the NextReader, ReadMessage and message
// described in the section on Control Messages above. // reader Read methods. The application must read the connection to process
// pong messages as described in the section on Control Messages above.
func (c *Conn) SetPongHandler(h func(appData string) error) { func (c *Conn) SetPongHandler(h func(appData string) error) {
if h == nil { if h == nil {
h = func(string) error { return nil } h = func(string) error { return nil }