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.

type IQ Uses

type IQ struct {
    stanza.IQ

    Ping struct{} `xml:"urn:xmpp:ping ping"`
}

IQ is encoded as a ping request.

Code:

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

ping := ping.IQ{
    IQ: stanza.IQ{To: j},
}
err := e.Encode(ping)
if err != nil {
    log.Fatal(err)
}

Output:

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

func (IQ) TokenReader Uses

func (iq IQ) TokenReader() xml.TokenReader

TokenReader satisfies the xmlstream.Marshaler interface.

func (IQ) WriteXML Uses

func (iq IQ) WriteXML(w xmlstream.TokenWriter) (n int, err error)

WriteXML satisfies the xmlstream.WriterTo interface. It is like MarshalXML except it writes tokens to w.

Package ping imports 3 packages (graph). Updated 2019-07-28. Refresh now. Tools for package owners.