Documentation ¶
Overview ¶
Package websocket 接收客户端消息,根据消息内容解包,调用对应模块API处理,然后封装返回
Index ¶
- Variables
- func RegisterCallFunc(cmd string, callFunc CallFunc)
- func RegisterCmd()
- type ActionWrap
- type CallFunc
- type DeviceWrap
- type Error
- type EventType
- type Message
- type MsgType
- type Result
- func CheckUpdate(cs callService) (result Result, err error)
- func ConnectDevice(cs callService) (result Result, err error)
- func DisconnectDevice(cs callService) (result Result, err error)
- func GetAttrs(cs callService) (result Result, err error)
- func OTA(cs callService) (result Result, err error)
- func SetAttrs(cs callService) (result Result, err error)
- func UpdateThingModel(cs callService) (result Result, err error)
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrClientNotFound = errors.New("client not found")
)
Functions ¶
func RegisterCallFunc ¶ added in v1.5.0
func RegisterCmd ¶ added in v1.5.0
func RegisterCmd()
Types ¶
type ActionWrap ¶
type DeviceWrap ¶
type Message ¶ added in v1.9.1
type Message struct { Type MsgType `json:"type"` // contains filtered or unexported fields }
func NewResponse ¶ added in v1.9.1
type Result ¶ added in v1.5.0
type Result map[string]interface{}
func CheckUpdate ¶ added in v1.9.1
CheckUpdate 检查设备是否有更新
func ConnectDevice ¶ added in v1.5.0
ConnectDevice 连接设备 TODO 直接替代添加设备接口?
func DisconnectDevice ¶ added in v1.5.0
DisconnectDevice 设备断开连接(取消配对等) TODO 直接替代删除设备接口?
func UpdateThingModel ¶ added in v1.9.1
UpdateThingModel 更新设备的影子模型字段
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server WebSocket服务端
func NewWebSocketServer ¶
func NewWebSocketServer() *Server
func (*Server) AcceptWebSocket ¶
func (*Server) OnDeviceChange ¶ added in v1.9.1
func (s *Server) OnDeviceChange(em event2.EventMessage) error
OnDeviceChange 设备状态,数量改变回调,会广播给所有客户端,并且触发场景
Click to show internal directories.
Click to hide internal directories.