From c9ce64ea0530df67677ed887e958969be86d7747 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Sat, 28 May 2016 23:59:17 +0800 Subject: [PATCH] Add Ping/Pong handler getter methods --- conn.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/conn.go b/conn.go index eff26c6..e05e0ac 100644 --- a/conn.go +++ b/conn.go @@ -872,6 +872,11 @@ func (c *Conn) SetReadLimit(limit int64) { 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. // The appData argument to h is the PING frame application data. The default // ping handler sends a pong to the peer. @@ -890,6 +895,11 @@ func (c *Conn) SetPingHandler(h func(appData string) error) { 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. // The appData argument to h is the PONG frame application data. The default // pong handler does nothing.