session

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options added in v0.50.0

type Options struct {

	// MaxStanzaSize defines the maximum stanza size that can be read from the session transport.
	MaxStanzaSize int

	// IsOut defines whether or not this is an initiating entity session.
	IsOut bool
}

Options structure is used to establish XMPP session options.

type Session

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

Session represents an XMPP session between two peers.

func New

func New(typ Type, identifier string, tr transport.Transport, hosts *host.Hosts, opts Options) *Session

New creates a new session instance.

func (*Session) Close

func (ss *Session) Close(ctx context.Context) error

Close closes session sending the proper XMPP payload.

func (*Session) OpenComponent added in v0.50.0

func (ss *Session) OpenComponent(ctx context.Context) error

OpenComponent initializes a component session sending the proper XMPP payload.

func (*Session) OpenStream added in v0.50.0

func (ss *Session) OpenStream(ctx context.Context, featuresElem stravaganza.Element) error

OpenStream initializes a session session sending the proper XMPP payload.

func (*Session) Receive

func (ss *Session) Receive() (stravaganza.Element, error)

Receive returns next incoming session element.

func (*Session) Reset added in v0.50.0

func (ss *Session) Reset(tr transport.Transport) error

Reset resets session internal state.

func (*Session) Send

func (ss *Session) Send(ctx context.Context, elem stravaganza.Element) error

Send writes an XML element to the underlying session transport.

func (*Session) SetFromJID added in v0.50.0

func (ss *Session) SetFromJID(jd *jid.JID)

SetFromJID updates current session from JID.

func (*Session) StreamID

func (ss *Session) StreamID() string

StreamID returns session stream identifier.

type Type added in v0.50.0

type Type uint8

Type represents session type.

const (
	// C2SSession represents a C2S session type.
	C2SSession Type = iota

	// S2SSession represents a S2S session type
	S2SSession

	// ComponentSession represents a component session type.
	ComponentSession
)

Jump to

Keyboard shortcuts

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