mux

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: BSD-2-Clause Imports: 5 Imported by: 6

Documentation

Overview

Package mux implements an XMPP multiplexer.

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(m *ServeMux)

Option configures a ServeMux.

func Handle

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

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

func IQ

func IQ(h xmpp.Handler) Option

IQ returns an option that matches on all IQ stanzas.

func Message

func Message(h xmpp.Handler) Option

Message returns an option that matches on all message stanzas.

func Presence

func Presence(h xmpp.Handler) Option

Presence returns an option that matches on all presence stanzas.

type ServeMux

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

func New(opt ...Option) *ServeMux

New allocates and returns a new ServeMux.

func (*ServeMux) HandleXMPP

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

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

Jump to

Keyboard shortcuts

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