Versions in this module Expand all Collapse all v1 v1.1.0 Apr 27, 2020 v1.0.0 Mar 21, 2020 Changes in this version + const DefaultDeadTime + const DefaultKeepAlive + const RecyleDuration + const ServiceRpcIn + const ServiceRpcOut + const ServiceRpcUp + const ServiceTopic + const ServiceUp + func SyncInvoker(invoker Invoker, param *InvokeParam, on OnResult, timeout time.Duration) error + type InvokeParam struct + Method string + Param string + type Invoker func(param *InvokeParam, on OnResult, timeout time.Duration) error + type MethodRequest func(param string) (string, error) + type MultiSubscribe struct + Subscribe func(lis *TopicHandler) + Unsubscribe func(lis *TopicHandler) + type OnResult func(result string, err error) + type OnServiceUp func(p *ServiceInfo) + type Register func(method string, f MethodRequest) + type SLink struct + func New(host string) *SLink + func (p *SLink) Connect() (MQTT.Client, error) + func (p *SLink) GetClient() MQTT.Client + func (p *SLink) InitRpcClient(serviceName string) (Invoker, error) + func (p *SLink) InitRpcServer(serviceName string) (Register, error) + func (p *SLink) NewMultiSubscribe(topic string) (*MultiSubscribe, error) + func (p *SLink) NewMultiSubscribes(topics []string) (map[string]*MultiSubscribe, error) + func (p *SLink) NewRpcClients(svcnames []string) (map[string]Invoker, error) + func (p *SLink) ProvideService(sInfo *ServiceInfo) + func (p *SLink) Publish(topic string, msg string) error + func (p *SLink) SetDeadTime(t time.Duration) *SLink + func (p *SLink) SetKeepAlive(t time.Duration) *SLink + func (p *SLink) SetOnServiceUp(serviceName string, onServiceUp OnServiceUp) (ServiceGetter, error) + func (p *SLink) SetPassword(password string) *SLink + func (p *SLink) SetUserName(name string) *SLink + func (p *SLink) Subscribe(topic string, th TopicHandler) error + func (p *SLink) Unsubscribe(topic string) error + type ServiceGetter func() *ServiceInfo + type ServiceInfo struct + IP string + Name string + Port int + type TopicHandler func(msg []byte)