Documentation

Index

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

      func (s *Service) Handle(request string, handler service.Handler)

        Handle adds a handler for an "emitter/..." request

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

          func (s *Service) OnPublish(c service.Conn, packet *mqtt.Publish) *errors.Error

            OnPublish is a handler for MQTT Publish events.

            func (*Service) OnSubscribe

            func (s *Service) OnSubscribe(c service.Conn, mqttTopic []byte) *errors.Error

              OnSubscribe is a handler for MQTT Subscribe events.

              func (*Service) OnUnsubscribe

              func (s *Service) OnUnsubscribe(c service.Conn, mqttTopic []byte) *errors.Error

                OnUnsubscribe is a handler for MQTT Unsubscribe events.

                func (*Service) Publish

                func (s *Service) Publish(m *message.Message, filter func(message.Subscriber) bool) (n int64)

                  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