Specify arguments to P(i|o)ngHandler

Previously, the parameters to the ping and pong handlers were not
documented. They are the payload of the ping and pong messages
respectively.

In the RFC this is referred to as "Application data".

See:
    https://tools.ietf.org/html/rfc6455#section-5.5.2
    https://tools.ietf.org/html/rfc6455#section-5.5.3
This commit is contained in:
Lorenz Leutgeb 2015-09-15 09:35:23 +02:00
parent b6ab76f1fe
commit 669dd64d20
1 changed files with 2 additions and 0 deletions

View File

@ -789,6 +789,7 @@ 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.
// It's argument is the payload or "Application data" of that very message.
// The default ping handler sends a pong to the peer. // The default ping handler sends a pong to the peer.
func (c *Conn) SetPingHandler(h func(string) error) { func (c *Conn) SetPingHandler(h func(string) error) {
if h == nil { if h == nil {
@ -801,6 +802,7 @@ 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.
// It's argument is the payload or "Application data" of that very message.
// The default pong handler does nothing. // The default pong handler does nothing.
func (c *Conn) SetPongHandler(h func(string) error) { func (c *Conn) SetPongHandler(h func(string) error) {
if h == nil { if h == nil {