clients

package
v1.2.20 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetMqttSetOnConnectHandler

func SetMqttSetOnConnectHandler(f func(cli mqtt.Client))

Types

type EmqGetClientsResp

type EmqGetClientsResp struct {
	Data []struct {
		HeapSize                         int       `json:"heap_size"`
		SendMsgDroppedExpired            int       `json:"send_msg.dropped.expired"`
		SendOct                          int       `json:"send_oct"`
		RecvMsgQos1                      int       `json:"recv_msg.qos1"`
		IsPersistent                     bool      `json:"is_persistent"`
		SendPkt                          int       `json:"send_pkt"`
		CleanStart                       bool      `json:"clean_start"`
		InflightCnt                      int       `json:"inflight_cnt"`
		Node                             string    `json:"node"`
		SendMsgDroppedQueueFull          int       `json:"send_msg.dropped.queue_full"`
		AwaitingRelCnt                   int       `json:"awaiting_rel_cnt"`
		InflightMax                      int       `json:"inflight_max"`
		CreatedAt                        time.Time `json:"created_at"`
		SubscriptionsCnt                 int       `json:"subscriptions_cnt"`
		MailboxLen                       int       `json:"mailbox_len"`
		SendCnt                          int       `json:"send_cnt"`
		Connected                        bool      `json:"connected"`
		IpAddress                        string    `json:"ip_address"`
		AwaitingRelMax                   int       `json:"awaiting_rel_max"`
		RecvMsgQos2                      int       `json:"recv_msg.qos2"`
		ProtoVer                         int       `json:"proto_ver"`
		Mountpoint                       string    `json:"mountpoint"`
		ProtoName                        string    `json:"proto_name"`
		Port                             int       `json:"port"`
		ConnectedAt                      time.Time `json:"connected_at"`
		EnableAuthn                      bool      `json:"enable_authn"`
		ExpiryInterval                   int       `json:"expiry_interval"`
		Username                         *string   `json:"username"`
		RecvMsg                          int       `json:"recv_msg"`
		RecvOct                          int       `json:"recv_oct"`
		SendMsgDroppedTooLarge           int       `json:"send_msg.dropped.too_large"`
		Keepalive                        int       `json:"keepalive"`
		SendMsgQos1                      int       `json:"send_msg.qos1"`
		SendMsgQos2                      int       `json:"send_msg.qos2"`
		RecvMsgQos0                      int       `json:"recv_msg.qos0"`
		SendMsgQos0                      int       `json:"send_msg.qos0"`
		SubscriptionsMax                 string    `json:"subscriptions_max"`
		MqueueMax                        int       `json:"mqueue_max"`
		MqueueDropped                    int       `json:"mqueue_dropped"`
		Clientid                         string    `json:"clientid"`
		IsBridge                         bool      `json:"is_bridge"`
		Peerport                         int       `json:"peerport"`
		SendMsg                          int       `json:"send_msg"`
		Listener                         string    `json:"listener"`
		RecvCnt                          int       `json:"recv_cnt"`
		RecvPkt                          int       `json:"recv_pkt"`
		RecvMsgDropped                   int       `json:"recv_msg.dropped"`
		SendMsgDropped                   int       `json:"send_msg.dropped"`
		RecvMsgDroppedAwaitPubrelTimeout int       `json:"recv_msg.dropped.await_pubrel_timeout"`
		Reductions                       int       `json:"reductions"`
		MqueueLen                        int       `json:"mqueue_len"`
	} `json:"data"`
	Meta struct {
		Count   int64 `json:"count"`
		Hasnext bool  `json:"hasnext"`
		Limit   int   `json:"limit"`
		Page    int   `json:"page"`
	} `json:"meta"`
}

type EmqResp

type EmqResp struct {
	Code    string `json:"code"` //如果不在线返回: CLIENTID_NOT_FOUND
	Message string `json:"message"`
}

type GetOnlineClientsFilter

type GetOnlineClientsFilter struct {
	UserName string
}

type MqttClient

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

func NewMqttClient

func NewMqttClient(conf *conf.MqttConf) (mcs *MqttClient, err error)

func (MqttClient) GetClientSub

func (m MqttClient) GetClientSub(ctx context.Context, clientID string) ([]string, error)

func (MqttClient) GetOnlineClients

func (m MqttClient) GetOnlineClients(ctx context.Context, f GetOnlineClientsFilter, page *PageInfo) ([]*devices.DevConn, int64, error)

func (MqttClient) Publish

func (m MqttClient) Publish(topic string, qos byte, retained bool, payload interface{}) error

func (MqttClient) SetClientMutSub

func (m MqttClient) SetClientMutSub(ctx context.Context, clientID string, topics []string, qos int) error

func (MqttClient) SetClientMutUnSub

func (m MqttClient) SetClientMutUnSub(ctx context.Context, clientID string, topics []string) error

func (MqttClient) Subscribe

func (m MqttClient) Subscribe(cli mqtt.Client, topic string, qos byte, callback mqtt.MessageHandler) error

type MutSubReq

type MutSubReq struct {
	Topic string `json:"topic"`
	Qos   int    `json:"qos"`
	Nl    int    `json:"nl"`
	Rap   int    `json:"rap"`
	Rh    int    `json:"rh"`
}

type OnlineClientsInfo

type OnlineClientsInfo struct {
	ClientID    string
	UserName    string
	ConnectedAt time.Time
}

type PageInfo

type PageInfo struct {
	Page int64 `json:"page" form:"page"`         // 页码
	Size int64 `json:"pageSize" form:"pageSize"` // 每页大小
}

Jump to

Keyboard shortcuts

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