ping

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: BSD-2-Clause Imports: 4 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

func IQ added in v0.3.0

func IQ(to jid.JID) xml.TokenReader

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

Example
package main

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

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

func main() {
	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>

Types

This section is empty.

Jump to

Keyboard shortcuts

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