session

package
v0.0.0-...-aeec266 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: BSD-3-Clause Imports: 15 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 {
	// JID defines an initial session JID.
	JID *jid.JID

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

	// RemoteDomain represents the remote receiving entity domain name.
	RemoteDomain string

	// IsServer defines whether or not this session is established by the server.
	IsServer bool

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

Config represents an XMPP session configuration.

type Error

type Error struct {
	// Element returns the original incoming element that generated the session error.
	Element xmpp.XElement

	// UnderlyingErr is the underlying session error.
	UnderlyingErr error
}

Error represents a session error.

type Session

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

Session represents an XMPP session between two peers.

func New

func New(id string, config *Config, tr transport.Transport, hosts *host.Hosts) *Session

New creates a new session instance.

func (*Session) Close

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

Close closes session sending the proper XMPP payload.

func (*Session) Open

func (s *Session) Open(ctx context.Context, featuresElem xmpp.XElement) error

Open initializes a sending the proper XMPP payload.

func (*Session) Receive

func (s *Session) Receive() (xmpp.XElement, *Error)

Receive returns next incoming session element.

func (*Session) Send

func (s *Session) Send(ctx context.Context, elem xmpp.XElement) error

Send writes an XML element to the underlying session transport.

func (*Session) SetJID

func (s *Session) SetJID(sessionJID *jid.JID)

SetJID updates current session JID.

func (*Session) SetRemoteDomain

func (s *Session) SetRemoteDomain(remoteDomain string)

SetRemoteDomain sets current session's remote domain.

func (*Session) StreamID

func (s *Session) StreamID() string

StreamID returns session stream identifier.

Jump to

Keyboard shortcuts

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