mirror of https://github.com/gorilla/websocket.git
Add Ping/Pong handler getter methods
This commit is contained in:
parent
0e2713e645
commit
c9ce64ea05
10
conn.go
10
conn.go
|
@ -872,6 +872,11 @@ func (c *Conn) SetReadLimit(limit int64) {
|
||||||
c.readLimit = limit
|
c.readLimit = limit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PingHandler returns the current ping handler
|
||||||
|
func (c *Conn) PingHandler() func(appData string) error {
|
||||||
|
return c.handlePing
|
||||||
|
}
|
||||||
|
|
||||||
// SetPingHandler sets the handler for ping messages received from the peer.
|
// SetPingHandler sets the handler for ping messages received from the peer.
|
||||||
// The appData argument to h is the PING frame application data. The default
|
// The appData argument to h is the PING frame application data. The default
|
||||||
// ping handler sends a pong to the peer.
|
// ping handler sends a pong to the peer.
|
||||||
|
@ -890,6 +895,11 @@ func (c *Conn) SetPingHandler(h func(appData string) error) {
|
||||||
c.handlePing = h
|
c.handlePing = h
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PongHandler returns the current pong handler
|
||||||
|
func (c *Conn) PongHandler() func(appData string) error {
|
||||||
|
return c.handlePong
|
||||||
|
}
|
||||||
|
|
||||||
// SetPongHandler sets the handler for pong messages received from the peer.
|
// SetPongHandler sets the handler for pong messages received from the peer.
|
||||||
// The appData argument to h is the PONG frame application data. The default
|
// The appData argument to h is the PONG frame application data. The default
|
||||||
// pong handler does nothing.
|
// pong handler does nothing.
|
||||||
|
|
Loading…
Reference in New Issue