mirror of https://github.com/gorilla/websocket.git
Document that default ping handler can block
This commit is contained in:
parent
a622679ebd
commit
e2e3d8414d
20
doc.go
20
doc.go
|
@ -85,18 +85,22 @@
|
||||||
// and pong. Call the connection WriteControl, WriteMessage or NextWriter
|
// and pong. Call the connection WriteControl, WriteMessage or NextWriter
|
||||||
// methods to send a control message to the peer.
|
// methods to send a control message to the peer.
|
||||||
//
|
//
|
||||||
// Connections handle received ping and pong messages by invoking callback
|
|
||||||
// functions set with SetPingHandler and SetPongHandler methods. The default
|
|
||||||
// ping handler sends a pong to the client. The callback functions can be
|
|
||||||
// invoked from the NextReader, ReadMessage or the message Read method.
|
|
||||||
//
|
|
||||||
// Connections handle received close messages by sending a close message to the
|
// Connections handle received close messages by sending a close message to the
|
||||||
// peer and returning a *CloseError from the the NextReader, ReadMessage or the
|
// peer and returning a *CloseError from the the NextReader, ReadMessage or the
|
||||||
// message Read method.
|
// message Read method.
|
||||||
//
|
//
|
||||||
// The application must read the connection to process ping and close messages
|
// Connections handle received ping and pong messages by invoking callback
|
||||||
// sent from the peer. If the application is not otherwise interested in
|
// functions set with SetPingHandler and SetPongHandler methods. The callback
|
||||||
// messages from the peer, then the application should start a goroutine to
|
// functions are called from the NextReader, ReadMessage and the message Read
|
||||||
|
// methods.
|
||||||
|
//
|
||||||
|
// The default ping handler sends a pong to the peer. The application's reading
|
||||||
|
// goroutine can block for a short time while the handler writes the pong data
|
||||||
|
// to the connection.
|
||||||
|
//
|
||||||
|
// The application must read the connection to process ping, pong 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:
|
// read and discard messages from the peer. A simple example is:
|
||||||
//
|
//
|
||||||
// func readLoop(c *websocket.Conn) {
|
// func readLoop(c *websocket.Conn) {
|
||||||
|
|
Loading…
Reference in New Issue