Documentation ¶
Index ¶
- Constants
- Variables
- func CmdDataMsg(str string) []byte
- func GetTopicAllDevice(topicName string) []string
- func GetTopicHasDevice(topicName, device string) (bool, error)
- func TopicDisconnection(topicName string)
- type AuthData
- type Client
- type CmdData
- type Device
- func (d *Device) AllTopic() []string
- func (d *Device) CancelTopic(topicName string) (err error)
- func (d *Device) Discharge(connType string)
- func (d *Device) GetGroup(conn Client)
- func (d *Device) GetTopic(conn Client)
- func (d *Device) OffLine()
- func (d *Device) OnLineState() bool
- func (d *Device) SetId(deviceId string) *Device
- func (d *Device) SubTopic(conn Client, topicName string) (err error)
- func (d *Device) UpLine()
- type Group
- type TcpClient
- func (tcp *TcpClient) AddConn(conn net.Conn) *TcpClient
- func (tcp *TcpClient) GetTcpConn() *TcpClient
- func (tcp *TcpClient) GetUdpConn() *UdpClient
- func (tcp *TcpClient) GetWsConn() *WsClient
- func (tcp *TcpClient) IntoAllClient(device string)
- func (tcp *TcpClient) Send(msg CmdData)
- func (tcp *TcpClient) SendMessage(str string)
- func (tcp *TcpClient) SetIP(ip string) *TcpClient
- func (tcp *TcpClient) TopicSend(data *mq.MQMsg)
- func (tcp *TcpClient) Who() string
- type Topic
- type TopicData
- type UdpClient
- func (udp *UdpClient) AddConn(conn *net.UDPAddr) *UdpClient
- func (udp *UdpClient) GetTcpConn() *TcpClient
- func (udp *UdpClient) GetUdpConn() *UdpClient
- func (udp *UdpClient) GetWsConn() *WsClient
- func (udp *UdpClient) IntoAllClient(device string)
- func (udp *UdpClient) Send(msg CmdData)
- func (udp *UdpClient) SendMessage(str string)
- func (udp *UdpClient) SetIP(ip string) *UdpClient
- func (udp *UdpClient) TopicSend(data *mq.MQMsg)
- func (udp *UdpClient) Who() string
- type WsClient
- func (ws *WsClient) AddConn(conn *websocket.Conn) *WsClient
- func (ws *WsClient) GetTcpConn() *TcpClient
- func (ws *WsClient) GetUdpConn() *UdpClient
- func (ws *WsClient) GetWsConn() *WsClient
- func (ws *WsClient) IntoAllClient(device string)
- func (ws *WsClient) Send(msg CmdData)
- func (ws *WsClient) SendMessage(str string)
- func (ws *WsClient) SetIP(ip string) *WsClient
- func (ws *WsClient) TopicSend(data *mq.MQMsg)
- func (ws *WsClient) Who() string
Constants ¶
View Source
const ( DeviceTopic = "d:%s:topic" // 设备订阅的topic set DeviceGroup = "d:%s:group" // 设备加入的组 set DeviceOnLine = "d:%s:onlien" // 0:不在线; 1:在线; string TopicKey = "topic:%s" // topic信息 hash TopicAllDevice = "topic:%s:all" // 已经订阅过该topic的所有设备 )
Variables ¶
View Source
var AllTcpClient = make(map[string]*TcpClient)
View Source
var AllWsClient = make(map[string]*WsClient)
View Source
var GroupMap = make(map[string]*Group)
View Source
var TopicMap map[string]*Topic
Functions ¶
func CmdDataMsg ¶
func GetTopicHasDevice ¶
查询topic是否被指定device订阅
Types ¶
type Client ¶
type TcpClient ¶
func NewTcpClient ¶
func NewTcpClient() *TcpClient
func (*TcpClient) GetTcpConn ¶
func (*TcpClient) GetUdpConn ¶
func (*TcpClient) IntoAllClient ¶
func (*TcpClient) SendMessage ¶
type Topic ¶
type UdpClient ¶
func NewUdpClient ¶
func NewUdpClient() *UdpClient
func (*UdpClient) GetTcpConn ¶
func (*UdpClient) GetUdpConn ¶
func (*UdpClient) IntoAllClient ¶
func (*UdpClient) SendMessage ¶
type WsClient ¶
func NewWsClient ¶
func NewWsClient() *WsClient
func (*WsClient) GetTcpConn ¶
func (*WsClient) GetUdpConn ¶
func (*WsClient) IntoAllClient ¶
func (*WsClient) SendMessage ¶
Click to show internal directories.
Click to hide internal directories.