session

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config 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
}

Config structure is used to establish XMPP session configuration.

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, cfg Config) *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

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

OpenComponent initializes a component session sending the proper XMPP payload.

func (*Session) OpenStream

func (ss *Session) OpenStream(ctx context.Context) 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

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

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

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