Document ping and pong handler argument

Closes #76
This commit is contained in:
Gary Burd 2015-09-15 11:02:48 -07:00
parent b6ab76f1fe
commit 39cd638460
1 changed files with 6 additions and 4 deletions

10
conn.go
View File

@ -789,8 +789,9 @@ func (c *Conn) SetReadLimit(limit int64) {
} }
// SetPingHandler sets the handler for ping messages received from the peer. // SetPingHandler sets the handler for ping messages received from the peer.
// The default ping handler sends a pong to the peer. // The appData argument to h is the PING frame application data. The default
func (c *Conn) SetPingHandler(h func(string) error) { // ping handler sends a pong to the peer.
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 {
c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait)) c.WriteControl(PongMessage, []byte(message), time.Now().Add(writeWait))
@ -801,8 +802,9 @@ func (c *Conn) SetPingHandler(h func(string) error) {
} }
// SetPongHandler sets the handler for pong messages received from the peer. // SetPongHandler sets the handler for pong messages received from the peer.
// The default pong handler does nothing. // The appData argument to h is the PONG frame application data. The default
func (c *Conn) SetPongHandler(h func(string) error) { // pong handler does nothing.
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 }
} }