Back to godoc.org

Package ping

v0.16.0
Latest Go to latest

The latest major version is .

Published: Mar 8, 2020 | License: BSD-2-Clause | Module: mellium.im/xmpp

Overview

Package ping implements XEP-0199: XMPP Ping.

Index

Constants

const NS = `urn:xmpp:ping`

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

func Handle

func Handle() mux.Option

Handle returns an option that registers a Handler for ping requests.

func Send

func Send(ctx context.Context, s *xmpp.Session, to jid.JID) error

Send sends a ping to the provided JID and blocks until a response is received. Pings sent to other clients should use the full JID, otherwise they will be handled by the server.

If the remote JID reports that the ping service is unavailable, no error is returned because we were able to receive the error response (the remote resource exists and could be pinged, it just doesn't support this particular protocol for doing so).

type Handler

type Handler struct{}

Handler responds to ping requests.

func (Handler) HandleIQ

func (h Handler) HandleIQ(iq stanza.IQ, t xmlstream.TokenReadEncoder, start *xml.StartElement) error

HandleIQ implements mux.IQHandler.

type IQ

type IQ struct {
	stanza.IQ

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

IQ is encoded as a ping request.

func (IQ) TokenReader

func (iq IQ) TokenReader() xml.TokenReader

TokenReader satisfies the xmlstream.Marshaler interface.

func (IQ) WriteXML

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 Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier