Documentation ¶
Index ¶
- type Config
- type ConnectionProvider
- type OfflinePublish
- type OnlinePublish
- type SubscriptionParams
- type Subscriptions
- type Type
- func (s *Type) Acquire()
- func (s *Type) HasSubscriptions() bool
- func (s *Type) Hash() uintptr
- func (s *Type) Offline(shutdown bool)
- func (s *Type) Online(c OnlinePublish)
- func (s *Type) Publish(m *packet.Publish, grantedQoS packet.QosType, ids []uint32) error
- func (s *Type) Release()
- func (s *Type) Subscribe(topic string, params *SubscriptionParams) (packet.QosType, []*packet.Publish, error)
- func (s *Type) Subscriptions() Subscriptions
- func (s *Type) UnSubscribe(topic string) error
- func (s *Type) Version() packet.ProtocolVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ID string Topics topicsTypes.SubscriberInterface OnOfflinePublish OfflinePublish OfflineQoS0 bool Version packet.ProtocolVersion }
Config subscriber config options
type ConnectionProvider ¶
type ConnectionProvider interface { Subscriptions() Subscriptions Subscribe(string, *SubscriptionParams) (packet.QosType, []*packet.Publish, error) UnSubscribe(string) error HasSubscriptions() bool Online(c OnlinePublish) Offline(bool) Version() packet.ProtocolVersion }
ConnectionProvider passed to present network connection
type OfflinePublish ¶
OfflinePublish invoked when subscriber respective to sessions receive message
type OnlinePublish ¶
OnlinePublish invoked when subscriber respective to sessions receive message
type SubscriptionParams ¶
type SubscriptionParams struct { // Subscription id // V5.0 ONLY ID uint32 // Requested QoS requested by subscriber Requested packet.SubscriptionOptions // Granted QoS granted by topics manager Granted packet.QosType }
SubscriptionParams parameters of the subscription
type Subscriptions ¶
type Subscriptions map[string]*SubscriptionParams
Subscriptions contains active subscriptions with respective subscription parameters
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type subscriber object
func (*Type) Acquire ¶
func (s *Type) Acquire()
Acquire prevent subscriber being deleted before active writes finished
func (*Type) HasSubscriptions ¶
HasSubscriptions either has active subscriptions or not
func (*Type) Hash ¶
Hash returns address of the provider struct. Used by topics provider as a key to subscriber object
func (*Type) Offline ¶
Offline put session offline if shutdown is true it does unsubscribe from all active subscriptions
func (*Type) Online ¶
func (s *Type) Online(c OnlinePublish)
Online moves subscriber to online state since this moment all of publishes are forwarded to provided callback
func (*Type) Publish ¶
Publish message accordingly to subscriber state online: forward message to session offline: persist message
func (*Type) Release ¶
func (s *Type) Release()
Release subscriber once topics provider finished write
func (*Type) Subscribe ¶
func (s *Type) Subscribe(topic string, params *SubscriptionParams) (packet.QosType, []*packet.Publish, error)
Subscribe to given topic
func (*Type) Subscriptions ¶
func (s *Type) Subscriptions() Subscriptions
Subscriptions list active subscriptions
func (*Type) UnSubscribe ¶
UnSubscribe from given topic
func (*Type) Version ¶
func (s *Type) Version() packet.ProtocolVersion
Version return MQTT protocol version