Documentation ¶
Index ¶
- type Service
- func (s *Service) Handle(request string, handler service.Handler)
- func (s *Service) OnLastWill(sub message.Subscriber, ev *event.Connection) bool
- func (s *Service) OnPublish(c service.Conn, packet *mqtt.Publish) *errors.Error
- func (s *Service) OnSubscribe(c service.Conn, mqttTopic []byte) *errors.Error
- func (s *Service) OnUnsubscribe(c service.Conn, mqttTopic []byte) *errors.Error
- func (s *Service) Publish(m *message.Message, filter func(message.Subscriber) bool) (n int64)
- func (s *Service) Subscribe(sub message.Subscriber, ev *event.Subscription) bool
- func (s *Service) Unsubscribe(sub message.Subscriber, ev *event.Subscription) (ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents a publish service.
func New ¶
func New(auth service.Authorizer, store storage.Storage, notifier service.Notifier, trie *message.Trie) *Service
New creates a new publisher service.
func (*Service) OnLastWill ¶
func (s *Service) OnLastWill(sub message.Subscriber, ev *event.Connection) bool
OnLastWill publishes a last will event of the subscriber.
func (*Service) OnSubscribe ¶
OnSubscribe is a handler for MQTT Subscribe events.
func (*Service) OnUnsubscribe ¶
OnUnsubscribe is a handler for MQTT Unsubscribe events.
func (*Service) Publish ¶
Publish publishes a message to everyone and returns the number of outgoing bytes written.
func (*Service) Subscribe ¶
func (s *Service) Subscribe(sub message.Subscriber, ev *event.Subscription) bool
Subscribe subscribes to a channel.
func (*Service) Unsubscribe ¶
func (s *Service) Unsubscribe(sub message.Subscriber, ev *event.Subscription) (ok bool)
Unsubscribe unsubscribes from a channel
Click to show internal directories.
Click to hide internal directories.