xmpp: mellium.im/xmpp/mux Index | Files

package mux

import "mellium.im/xmpp/mux"

Package mux implements an XMPP multiplexer.

Be advised: This package is experimental and likely to change or be removed entirely.

Index

Package Files

mux.go

type Option Uses

type Option func(m *ServeMux)

Option configures a ServeMux.

func Handle Uses

func Handle(n xml.Name, h xmpp.Handler) Option

Handle returns an option that matches on the provided XML name.

func HandleFunc Uses

func HandleFunc(n xml.Name, h xmpp.HandlerFunc) Option

HandleFunc returns an option that matches on the provided XML name.

func IQ Uses

func IQ(h xmpp.Handler) Option

IQ returns an option that matches on all IQ stanzas.

func IQFunc Uses

func IQFunc(h xmpp.HandlerFunc) Option

IQFunc returns an option that matches on all IQ stanzas.

func Message Uses

func Message(h xmpp.Handler) Option

Message returns an option that matches on all message stanzas.

func MessageFunc Uses

func MessageFunc(h xmpp.HandlerFunc) Option

MessageFunc returns an option that matches on all message stanzas.

func Presence Uses

func Presence(h xmpp.Handler) Option

Presence returns an option that matches on all presence stanzas.

func PresenceFunc Uses

func PresenceFunc(h xmpp.HandlerFunc) Option

PresenceFunc returns an option that matches on all presence stanzas.

type ServeMux Uses

type ServeMux struct {
    // contains filtered or unexported fields
}

ServeMux is an XMPP stream multiplexer. It matches the start element token of each top level stream element against a list of registered patterns and calls the handler for the pattern that most closely matches the token.

Patterns are XML names. If either the namespace or the localname is left off, any namespace or localname will be matched. Full XML names take precedence, followed by wildcard namespaces, followed by wildcard localnames.

func New Uses

func New(opt ...Option) *ServeMux

New allocates and returns a new ServeMux.

func (*ServeMux) HandleXMPP Uses

func (m *ServeMux) HandleXMPP(t xmlstream.TokenReadWriter, start *xml.StartElement) error

HandleXMPP dispatches the request to the handler whose pattern most closely matches start.Name.

func (*ServeMux) Handler Uses

func (m *ServeMux) Handler(name xml.Name) (h xmpp.Handler, ok bool)

Handler returns the handler to use for a top level element with the provided XML name. If no handler exists, a default handler is returned (h is always non-nil).

Package mux imports 5 packages (graph). Updated 2018-11-15. Refresh now. Tools for package owners.