edgehub源码分析
edgehub 源码分析
结构定义及初始化
type EdgeHub struct {
context *beehiveContext.Context
chClient clients.Adapter
config *config.ControllerConfig
reconnectChan chan struct{}
cancel context.CancelFunc
syncKeeper map[string]chan model.Message
keeperLock sync.RWMutex
}func Register() {
core.Register(&EdgeHub{
config: &config.GetConfig().CtrConfig,
reconnectChan: make(chan struct{}),
syncKeeper: make(map[string]chan model.Message),
})
}给其他组件同步连接成功状态
发消息
接下来启动了三个协程
routeToEdge
routeToCloud
keepalive

Last updated