management

package
v0.0.25 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Online  = "online"
	Offline = "offline"
)

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type ClientInfo

type ClientInfo struct {
	ClientID       string    `json:"client_id"`
	Username       string    `json:"username"`
	Password       string    `json:"password"`
	KeepAlive      uint16    `json:"keep_alive"`
	CleanSession   bool      `json:"clean_session"`
	WillFlag       bool      `json:"will_flag"`
	WillRetain     bool      `json:"will_retain"`
	WillQos        uint8     `json:"will_qos"`
	WillTopic      string    `json:"will_topic"`
	WillPayload    string    `json:"will_payload"`
	RemoteAddr     string    `json:"remote_addr"`
	LocalAddr      string    `json:"local_addr"`
	ConnectedAt    time.Time `json:"connected_at"`
	DisconnectedAt time.Time `json:"disconnected_at"`
}

ClientInfo represents the client information

type Management

type Management struct {
	// contains filtered or unexported fields
}

func NewManagement

func NewManagement() *Management

func (*Management) CloseClient

func (m *Management) CloseClient(clientId string) (err error)

CloseClient

func (*Management) GetClient

func (m *Management) GetClient(clientId string) (client *ClientInfo, err error)

GetClient

func (*Management) GetClients

func (m *Management) GetClients(limit, offset int) (list []*ClientInfo, total int, err error)

GetClients

func (*Management) GetSession

func (m *Management) GetSession(clientId string) (session *SessionInfo, err error)

GetSession

func (*Management) GetSessions

func (m *Management) GetSessions(limit, offset int) (list []*SessionInfo, total int, err error)

GetSessions

func (*Management) GetSubscriptions

func (m *Management) GetSubscriptions(clientId string, limit, offset int) (list []*SubscriptionInfo, total int, err error)

GetSubscriptions

func (*Management) HookWrapper

func (m *Management) HookWrapper() gmqtt.HookWrapper

func (*Management) Load

func (m *Management) Load(service gmqtt.ServerService) error

func (*Management) Name

func (m *Management) Name() string

func (*Management) OnSessionCreatedWrapper

func (m *Management) OnSessionCreatedWrapper(created gmqtt.OnSessionCreated) gmqtt.OnSessionCreated

OnSessionCreatedWrapper store the client when session created

func (*Management) OnSessionResumedWrapper

func (m *Management) OnSessionResumedWrapper(resumed gmqtt.OnSessionResumed) gmqtt.OnSessionResumed

OnSessionResumedWrapper refresh the client when session resumed

func (*Management) OnSessionTerminatedWrapper

func (m *Management) OnSessionTerminatedWrapper(terminated gmqtt.OnSessionTerminated) gmqtt.OnSessionTerminated

OnSessionTerminated remove the client when session terminated

func (*Management) OnSubscribedWrapper

func (m *Management) OnSubscribedWrapper(subscribed gmqtt.OnSubscribed) gmqtt.OnSubscribed

OnSubscribedWrapper store the subscription

func (*Management) OnUnsubscribedWrapper

func (m *Management) OnUnsubscribedWrapper(unsubscribe gmqtt.OnUnsubscribed) gmqtt.OnUnsubscribed

OnUnsubscribedWrapper remove the subscription

func (*Management) Publish

func (m *Management) Publish(topic string, qos int, payload []byte, retain bool) (err error)

Publish

func (*Management) SearchTopic added in v0.0.21

func (m *Management) SearchTopic(query string) (result []*SubscriptionInfo, err error)

SearchTopic

func (*Management) Subscribe

func (m *Management) Subscribe(clientId, topic string, qos int) (err error)

Subscribe

func (*Management) Unload

func (m *Management) Unload() error

func (*Management) Unsubscribe

func (m *Management) Unsubscribe(clientId, topic string) (err error)

Unsubscribe

type SessionInfo

type SessionInfo struct {
	ClientID          string    `json:"client_id"`
	Status            string    `json:"status"`
	CleanSession      bool      `json:"clean_session"`
	Subscriptions     int64     `json:"subscriptions"`
	MaxInflight       int       `json:"max_inflight"`
	InflightLen       int64     `json:"inflight_len"`
	MaxMsgQueue       int       `json:"max_msg_queue"`
	MsgQueueLen       int64     `json:"msg_queue_len"`
	MaxAwaitRel       int       `json:"max_await_rel"`
	AwaitRelLen       int64     `json:"await_rel_len"`
	MsgDroppedTotal   int64     `json:"msg_dropped_total"`
	MsgDeliveredTotal int64     `json:"msg_delivered_total"`
	ConnectedAt       time.Time `json:"connected_at"`
	DisconnectedAt    time.Time `json:"disconnected_at"`
}

SessionInfo represents the session information

type SubscriptionInfo

type SubscriptionInfo struct {
	ClientID string    `json:"client_id"`
	Qos      uint8     `json:"qos"`
	Name     string    `json:"name"`
	At       time.Time `json:"at"`
}

SubscriptionInfo represents the subscription information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL