management

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

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

Variables

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

ErrNotFound ...

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
}

Management ...

func New added in v0.1.0

func New() *Management

New ...

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

HookWrapper ...

func (*Management) Load

func (m *Management) Load(server gmqtt.Server) error

Load ...

func (*Management) Name

func (m *Management) Name() string

Name ...

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

Unload ...

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         uint64    `json:"subscriptions"`
	MaxInflight           int       `json:"max_inflight"`
	InflightLen           uint64    `json:"inflight_len"`
	MaxMsgQueue           int       `json:"max_msg_queue"`
	MsgQueueLen           uint64    `json:"msg_queue_len"`
	MaxAwaitRel           int       `json:"max_await_rel"`
	AwaitRelLen           uint64    `json:"await_rel_len"`
	Qos0MsgDroppedTotal   uint64    `json:"qos0_msg_dropped_total"`
	Qos1MsgDroppedTotal   uint64    `json:"qos1_msg_dropped_total"`
	Qos2MsgDroppedTotal   uint64    `json:"qos2_msg_dropped_total"`
	Qos0MsgDeliveredTotal uint64    `json:"qos0_msg_delivered_total"`
	Qos1MsgDeliveredTotal uint64    `json:"qos1_msg_delivered_total"`
	Qos2MsgDeliveredTotal uint64    `json:"qos2_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