session

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2018 License: GPL-3.0 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

	// Transport provides the underlying session transport
	// that will be used to send and received elements.
	Transport transport.Transport

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

	// Remote domain 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
}

A Config structure is used to configure an XMPP session.

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 the two peers.

func New

func New(id string, config *Config) *Session

New creates a new session instance.

func (*Session) Close

func (s *Session) Close() error

Close closes session sending the proper XMPP payload. Is responsability of the caller to close underlying transport.

func (*Session) Open

func (s *Session) Open() 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(elem xmpp.XElement)

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