xmpp: mellium.im/xmpp/ping Index | Examples | Files

package ping

import "mellium.im/xmpp/ping"

Package ping implements XEP-0199: XMPP Ping.

Index

Examples

Package Files

ping.go

Constants

const NS = `urn:xmpp:ping`

NS is the XML namespace used by XMPP pings. It is provided as a convenience.

func IQ Uses

func IQ(to jid.JID) xml.TokenReader

IQ returns an xml.TokenReader that outputs a new IQ stanza with a ping payload.

Code:

j := jid.MustParse("feste@example.net/siJo4eeT")
e := xml.NewEncoder(os.Stdout)
e.Indent("", "\t")

ping := ping.IQ(j)
if _, err := xmlstream.Copy(e, ping); err != nil {
    log.Fatal(err)
}
if err := e.Flush(); err != nil {
    log.Fatal(err)
}

Output:

<iq type="get" to="feste@example.net/siJo4eeT">
	<ping xmlns="urn:xmpp:ping"></ping>
</iq>

Package ping imports 4 packages (graph). Updated 2018-10-06. Refresh now. Tools for package owners.