Documentation ¶
Index ¶
- Constants
- type C2S
- func (s *C2S) Context() map[string]interface{}
- func (s *C2S) Disconnect(_ context.Context, _ error)
- func (s *C2S) Domain() string
- func (s *C2S) GetBool(key string) bool
- func (s *C2S) GetFloat(key string) float64
- func (s *C2S) GetInt(key string) int
- func (s *C2S) GetString(key string) string
- func (s *C2S) ID() string
- func (s *C2S) IsAuthenticated() bool
- func (s *C2S) IsSecured() bool
- func (s *C2S) JID() *jid.JID
- func (s *C2S) Presence() *xmpp.Presence
- func (s *C2S) Resource() string
- func (s *C2S) SendElement(ctx context.Context, elem xmpp.XElement)
- func (s *C2S) SetBool(_ context.Context, _ string, _ bool)
- func (s *C2S) SetFloat(_ context.Context, _ string, _ float64)
- func (s *C2S) SetInt(_ context.Context, _ string, _ int)
- func (s *C2S) SetPresence(presence *xmpp.Presence)
- func (s *C2S) SetString(_ context.Context, _ string, _ string)
- func (s *C2S) UpdateContext(m map[string]interface{})
- func (s *C2S) Username() string
- type Cluster
- func (c *Cluster) BroadcastMessage(ctx context.Context, msg *Message)
- func (c *Cluster) C2SStream(jid *jid.JID, presence *xmpp.Presence, context map[string]interface{}, ...) *C2S
- func (c *Cluster) Join() error
- func (c *Cluster) LocalNode() string
- func (c *Cluster) SendMessageTo(ctx context.Context, node string, msg *Message)
- func (c *Cluster) Shutdown() error
- type Config
- type Delegate
- type Message
- type MessagePayload
- type Metadata
- type Node
Constants ¶
const ( // MsgBind represents a bind cluster message. MsgBind = iota // MsgBatchBind represents a batch bind cluster message. MsgBatchBind // MsgUnbind represents a unbind cluster message. MsgUnbind // MsgUpdatePresence represents an update presence cluster message. MsgUpdatePresence // MsgUpdateContext represents a context update cluster message. MsgUpdateContext // MsgRouteStanza represents a route stanza cluster message. MsgRouteStanza )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type C2S ¶
type C2S struct {
// contains filtered or unexported fields
}
C2S represents a cluster c2s stream.
func (*C2S) Disconnect ¶
Disconnect disconnects remote peer by closing the underlying TCP socket connection.
func (*C2S) IsAuthenticated ¶
IsAuthenticated returns whether or not the XMPP stream has successfully authenticated.
func (*C2S) IsSecured ¶
IsSecured returns whether or not the XMPP stream has been secured using SSL/TLS.
func (*C2S) SendElement ¶
SendElement writes an XMPP element to the stream.
func (*C2S) SetPresence ¶
SetPresence updates the C2S stream presence.
func (*C2S) UpdateContext ¶
UpdateContext updates stream context by copying all 'm' values
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster represents a c2s sub system.
func (*Cluster) BroadcastMessage ¶
BroadcastMessage broadcasts a cluster message to all nodes.
func (*Cluster) C2SStream ¶
func (c *Cluster) C2SStream(jid *jid.JID, presence *xmpp.Presence, context map[string]interface{}, node string) *C2S
C2SStream returns a cluster C2S stream.
func (*Cluster) SendMessageTo ¶
SendMessageTo sends a cluster message to a concrete node.
type Config ¶
Config represents an cluster configuration.
func (*Config) UnmarshalYAML ¶ added in v0.8.0
UnmarshalYAML satisfies Unmarshaler interface.
type Delegate ¶
type Delegate interface { NodeJoined(ctx context.Context, node *Node) NodeUpdated(ctx context.Context, node *Node) NodeLeft(ctx context.Context, node *Node) NotifyMessage(ctx context.Context, msg *Message) }
Delegate is the interface that will receive all c2s related events.
type Message ¶
type Message struct { Type int Node string Payloads []MessagePayload }
Message is the c2s message type. A message can contain one or more payloads.
type MessagePayload ¶
MessagePayload represents a message payload type.