ping

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2019 License: BSD-2-Clause Imports: 3 Imported by: 1

Documentation

Overview

Package ping implements XEP-0199: XMPP Ping.

Index

Examples

Constants

View Source
const NS = `urn:xmpp:ping`

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

Variables

This section is empty.

Functions

This section is empty.

Types

type IQ added in v0.3.0

type IQ struct {
	stanza.IQ

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

IQ is encoded as a ping request.

Example
package main

import (
	"encoding/xml"
	"log"
	"os"

	"mellium.im/xmpp/jid"
	"mellium.im/xmpp/ping"
	"mellium.im/xmpp/stanza"
)

func main() {
	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 added in v0.14.0

func (iq IQ) TokenReader() xml.TokenReader

TokenReader satisfies the xmlstream.Marshaler interface.

func (IQ) WriteXML added in v0.14.0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL