From a74ec7bb2d7cb6930f2fcef30fb5ba3b8691e464 Mon Sep 17 00:00:00 2001 From: Vincent van Dam Date: Mon, 6 Mar 2017 15:06:43 +0100 Subject: [PATCH] Add SendKeepAlive method to send "whitespace keepalive" --- xmpp.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xmpp.go b/xmpp.go index 7769a0c..84c4ad4 100644 --- a/xmpp.go +++ b/xmpp.go @@ -633,6 +633,11 @@ func (c *Client) SendPresence(presence Presence) (n int, err error) { return fmt.Fprintf(c.conn, "", xmlEscape(presence.From), xmlEscape(presence.To)) } +// SendKeepAlive sends a "whitespace keepalive" as described in chapter 4.6.1 of RFC6120. +func (c *Client) SendKeepAlive() (n int, err error) { + return fmt.Fprintf(c.conn," ") +} + // SendHtml sends the message as HTML as defined by XEP-0071 func (c *Client) SendHtml(chat Chat) (n int, err error) { return fmt.Fprintf(c.conn, ""+