Documentation ¶
Index ¶
Constants ¶
View Source
const ( DISCONNECTED = ConnectStatus(iota) CONNECTED CLOSED RECONNECTING CONNECTING )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient creates a new client. addr is the address of the server. example: "tcp://localhost:5100"
func (*Client) Disconnect ¶
Disconnect disconnects from the server.
func (*Client) SendMessage ¶
func (c *Client) SendMessage(payload []byte, channel wkproto.Channel, opt ...SendOption) (*wkproto.SendackPacket, error)
SendMessage sends a message to the server.
type ConnectStatus ¶
type ConnectStatus int
Status represents the state of the connection.
func (ConnectStatus) String ¶
func (s ConnectStatus) String() string
type Message ¶
type Message struct { wkproto.RecvPacket Ack func() error }
type Option ¶
type Option func(opt *Options)
func WithAutoAck ¶
func WithConnectTimeout ¶
func WithPingInterval ¶
func WithProtoVersion ¶
func WithReconnect ¶
type Options ¶
type SendOption ¶
type SendOption func(*SendOptions) error
SendOption 参数项
func SendOptionWithClientMsgNo ¶
func SendOptionWithClientMsgNo(clientMsgNo string) SendOption
SendOptionWithClientMsgNo 是否显示红点
func SendOptionWithNoEncrypt ¶
func SendOptionWithNoEncrypt(noEncrypt bool) SendOption
SendOptionWithNoEncrypt 是否不需要加密
func SendOptionWithNoPersist ¶
func SendOptionWithNoPersist(noPersist bool) SendOption
SendOptionWithNoPersist 是否不存储
func SendOptionWithRedDot ¶
func SendOptionWithRedDot(redDot bool) SendOption
SendOptionWithRedDot 是否显示红点
func SendOptionWithSyncOnce ¶
func SendOptionWithSyncOnce(syncOnce bool) SendOption
SendOptionWithSyncOnce 是否只同步一次(写模式)
Click to show internal directories.
Click to hide internal directories.