Documentation ¶
Index ¶
- type ActionFn
- type Client
- func (p *Client) AddAction(actionFn ActionFn)
- func (p *Client) ConnectToTCP(addr string, tlsConfig ...*tls.Config) error
- func (p *Client) ConnectToWS(addr string, path string, tlsConfig ...*tls.Config) error
- func (p *Client) Disconnect()
- func (p *Client) HandshakeData() *HandshakeData
- func (p *Client) IsConnected() bool
- func (p *Client) Notify(route string, val interface{}) error
- func (p *Client) On(route string, fn OnMessageFn)
- func (p *Client) Request(route string, val interface{}) (*pomeloMessage.Message, error)
- func (p *Client) Send(msgType pomeloMessage.Type, route string, val interface{}) (uint, error)
- func (p *Client) SendRaw(typ pomeloPacket.Type, data []byte) error
- func (p *Client) Serializer() cfacade.ISerializer
- type HandshakeData
- type HandshakeSys
- type OnMessageFn
- type Option
- type RequestContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { TagName string // 客户标识 // contains filtered or unexported fields }
Client struct
func (*Client) ConnectToTCP ¶
func (*Client) ConnectToWS ¶
func (*Client) Disconnect ¶
func (p *Client) Disconnect()
func (*Client) HandshakeData ¶
func (p *Client) HandshakeData() *HandshakeData
func (*Client) IsConnected ¶
IsConnected return the connection status
func (*Client) Request ¶
func (p *Client) Request(route string, val interface{}) (*pomeloMessage.Message, error)
func (*Client) Serializer ¶
func (p *Client) Serializer() cfacade.ISerializer
type HandshakeData ¶
type HandshakeData struct { Code int `json:"code"` Sys HandshakeSys `json:"sys"` }
HandshakeData struct
type HandshakeSys ¶
type HandshakeSys struct { Dict map[string]uint16 `json:"dict"` Heartbeat int `json:"heartbeat"` Serializer string `json:"serializer"` }
HandshakeSys struct
type OnMessageFn ¶
type OnMessageFn func(msg *pomeloMessage.Message)
type Option ¶
type Option func(options *options)
func WithErrorBreak ¶
func WithHandshake ¶
func WithHeartbeat ¶
func WithRequestTimeout ¶
func WithSerializer ¶
func WithSerializer(serializer cfacade.ISerializer) Option
type RequestContext ¶
func NewRequestContext ¶
func NewRequestContext(t time.Duration) RequestContext
func (*RequestContext) Close ¶
func (p *RequestContext) Close()
Click to show internal directories.
Click to hide internal directories.