Documentation ¶
Index ¶
- func Destroy(hd Handle)
- type Handle
- type OnConnectHandler
- type OnDataHandler
- type OnDisconnectHandler
- type OnReconnectHandler
- type Options
- func (o *Options) SetAddress(address string) *Options
- func (o *Options) SetAuthenticationEnable(authenticationEnable bool) *Options
- func (o *Options) SetAuthenticationKey(authenticationKey string) *Options
- func (o *Options) SetAutoReconnect(autoReconnect bool) *Options
- func (o *Options) SetOnConnectHandler(onConn OnConnectHandler) *Options
- func (o *Options) SetOnDataHandler(onData OnDataHandler) *Options
- func (o *Options) SetOnDisconnectHandler(onLost OnDisconnectHandler) *Options
- func (o *Options) SetOnReconnectHandler(onReconnect OnReconnectHandler) *Options
- func (o *Options) SetReconnectInterval(interval time.Duration) *Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OnDataHandler ¶
OnDataHandler 客户端收到数据后的回调函数
type OnDisconnectHandler ¶
OnDisconnectHandler 客户端断开后的回调函数
type OnReconnectHandler ¶
type OnReconnectHandler func(Handle)
OnReconnectHandler sets the function to be called when the client is reconnected.
type Options ¶
type Options struct { Address string `json:"address"` KeepAlive time.Duration `json:"keepalive"` AuthenticationEnable bool `json:"authenticationEnable"` AuthenticationKey string `json:"authenticationKey"` AutoReconnect bool `json:"autoReconnect"` ReconnectInterval time.Duration `json:"reconnectInterval"` OnConnect OnConnectHandler OnDisconnect OnDisconnectHandler OnData OnDataHandler OnReconnecting OnReconnectHandler }
func (*Options) SetAddress ¶
SetAddress sets the address to be used by the client to connect.
func (*Options) SetAuthenticationEnable ¶
SetAuthenticationEnable sets the function to be called when the client connected and for the first time receives data.
func (*Options) SetAuthenticationKey ¶
SetAuthenticationKey sets the key to be used when the client connected and for the first time send data.
func (*Options) SetAutoReconnect ¶
SetAutoReconnect sets the function to be called when the client is reconnected.
func (*Options) SetOnConnectHandler ¶
func (o *Options) SetOnConnectHandler(onConn OnConnectHandler) *Options
SetOnConnectHandler sets the function to be called when the client is connected. Both
func (*Options) SetOnDataHandler ¶
func (o *Options) SetOnDataHandler(onData OnDataHandler) *Options
SetOnDataHandler sets the function to be called when the client receives data.
func (*Options) SetOnDisconnectHandler ¶
func (o *Options) SetOnDisconnectHandler(onLost OnDisconnectHandler) *Options
SetOnDisconnectHandler sets the function to be called when the client is disconnected.
func (*Options) SetOnReconnectHandler ¶
func (o *Options) SetOnReconnectHandler(onReconnect OnReconnectHandler) *Options
SetOnReconnectHandler sets the function to be called when the client is reconnected.