Documentation

Overview

    Package ping implements XEP-0199: XMPP Ping.

    Index

    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 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).

          Types

          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) MarshalXML

                func (iq IQ) MarshalXML(e *xml.Encoder, _ xml.StartElement) error

                  MarshalXML implements xml.Marshaler.

                  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) (int, error)

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

                      Source Files