Documentation
¶
Index ¶
- type Config
- type OfflinePublish
- type OnlinePublish
- type Provider
- type ProviderType
- func (s *ProviderType) Acquire()
- func (s *ProviderType) Hash() uintptr
- func (s *ProviderType) Publish(m *message.PublishMessage, grantedQoS message.QosType, ids []uint32) error
- func (s *ProviderType) PutOffline(shutdown bool)
- func (s *ProviderType) Release()
- func (s *ProviderType) SetOnlineCallback(c OnlinePublish)
- func (s *ProviderType) Subscribe(topic string, params *SubscriptionParams) (message.QosType, []*message.PublishMessage, error)
- func (s *ProviderType) Subscriptions() Subscriptions
- func (s *ProviderType) UnSubscribe(topic string) error
- func (s *ProviderType) Version() message.ProtocolVersion
- type SessionProvider
- type SubscriptionParams
- type Subscriptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ID client id ID string // Callback to invoke when subscriber is offline Offline OfflinePublish // Topics manager Topics topicsTypes.SubscriberInterface // Version MQTT protocol version Version message.ProtocolVersion // OfflineQoS0 either queue QoS0 messages when offline or not OfflineQoS0 bool }
Config of subscriber
type OfflinePublish ¶
type OfflinePublish func(string, *message.PublishMessage)
OfflinePublish invoked when subscriber respective to sessions receive message
type OnlinePublish ¶
type OnlinePublish func(*message.PublishMessage) error
OnlinePublish invoked when subscriber respective to sessions receive message
type Provider ¶
type Provider interface { Subscribe(string, *SubscriptionParams) (message.QosType, []*message.PublishMessage, error) UnSubscribe(string) error SetOnlineCallback(OnlinePublish) Subscriptions() Subscriptions PutOffline(bool) Version() message.ProtocolVersion }
Provider general provider
type ProviderType ¶
type ProviderType struct {
// contains filtered or unexported fields
}
ProviderType the subscription object It is public definition only for topics tests
func (*ProviderType) Acquire ¶
func (s *ProviderType) Acquire()
Acquire prevent subscriber being deleted before active writes finished
func (*ProviderType) Hash ¶
func (s *ProviderType) Hash() uintptr
Hash returns address of the provider struct. Used by topics provider as a key to subscriber object
func (*ProviderType) Publish ¶
func (s *ProviderType) Publish(m *message.PublishMessage, grantedQoS message.QosType, ids []uint32) error
Publish message accordingly to subscriber state online: forward message to session offline: persist message
func (*ProviderType) PutOffline ¶
func (s *ProviderType) PutOffline(shutdown bool)
PutOffline put subscriber offline if shutdown is true it does unsubscribe from all active subscriptions
func (*ProviderType) Release ¶
func (s *ProviderType) Release()
Release subscriber once topics provider finished write
func (*ProviderType) SetOnlineCallback ¶
func (s *ProviderType) SetOnlineCallback(c OnlinePublish)
SetOnlineCallback moves subscriber to online state since this moment all of publishes are forwarded to provided callback
func (*ProviderType) Subscribe ¶
func (s *ProviderType) Subscribe(topic string, params *SubscriptionParams) (message.QosType, []*message.PublishMessage, error)
Subscribe to given topic
func (*ProviderType) Subscriptions ¶
func (s *ProviderType) Subscriptions() Subscriptions
Subscriptions list active subscriptions
func (*ProviderType) UnSubscribe ¶
func (s *ProviderType) UnSubscribe(topic string) error
UnSubscribe from given topic
func (*ProviderType) Version ¶
func (s *ProviderType) Version() message.ProtocolVersion
Version MQTT protocol version
type SessionProvider ¶ added in v0.0.4
type SessionProvider interface { Subscribe(string, *SubscriptionParams) (message.QosType, []*message.PublishMessage, error) UnSubscribe(string) error SetOnlineCallback(OnlinePublish) PutOffline(bool) }
SessionProvider passed to session
type SubscriptionParams ¶
type SubscriptionParams struct { // Subscription id // V5.0 ONLY ID uint32 // Requested QoS requested by subscriber Requested message.SubscriptionOptions // Granted QoS granted by topics manager Granted message.QosType }
SubscriptionParams parameters of the subscription
type Subscriptions ¶
type Subscriptions map[string]*SubscriptionParams
Subscriptions contains active subscriptions with respective subscription parameters