|
86 | 86 | // and pong. Call the connection WriteControl, WriteMessage or NextWriter
|
87 | 87 | // methods to send a control message to the peer.
|
88 | 88 | //
|
89 |
| -// Connections handle received close messages by sending a close message to the |
90 |
| -// peer and returning a *CloseError from the the NextReader, ReadMessage or the |
91 |
| -// message Read method. |
92 |
| -// |
93 |
| -// Connections handle received ping and pong messages by invoking callback |
94 |
| -// functions set with SetPingHandler and SetPongHandler methods. The callback |
95 |
| -// functions are called from the NextReader, ReadMessage and the message Read |
96 |
| -// methods. |
97 |
| -// |
98 |
| -// The default ping handler sends a pong to the peer. The application's reading |
99 |
| -// goroutine can block for a short time while the handler writes the pong data |
100 |
| -// to the connection. |
101 |
| -// |
102 |
| -// The application must read the connection to process ping, pong and close |
| 89 | +// Connections handle received close messages by calling the handler function |
| 90 | +// set with the SetCloseHandler method and by returning a *CloseError from the |
| 91 | +// NextReader, ReadMessage or the message Read method. The default close |
| 92 | +// handler sends a close message to the peer. |
| 93 | +// |
| 94 | +// Connections handle received ping messages by calling the handler function |
| 95 | +// set with the SetPingHandler method. The default ping handler sends a pong |
| 96 | +// message to the peer. |
| 97 | +// |
| 98 | +// Connections handle received pong messages by calling the handler function |
| 99 | +// set with the SetPongHandler method. The default pong handler does nothing. |
| 100 | +// If an application sends ping messages, then the application should set a |
| 101 | +// pong handler to receive the corresponding pong. |
| 102 | +// |
| 103 | +// The control message handler functions are called from the NextReader, |
| 104 | +// ReadMessage and message reader Read methods. The default close and ping |
| 105 | +// handlers can block these methods for a short time when the handler writes to |
| 106 | +// the connection. |
| 107 | +// |
| 108 | +// The application must read the connection to process close, ping and pong |
103 | 109 | // messages sent from the peer. If the application is not otherwise interested
|
104 | 110 | // in messages from the peer, then the application should start a goroutine to
|
105 | 111 | // read and discard messages from the peer. A simple example is:
|
|
0 commit comments