Documentation ¶
Index ¶
- type Client
- func (c *Client) ConnectTo(addr string, tlsConfig ...*tls.Config) error
- func (c *Client) ConnectToWS(addr string, path string, tlsConfig ...*tls.Config) error
- func (c *Client) ConnectedStatus() bool
- func (c *Client) Disconnect()
- func (c *Client) MsgChannel() chan *message.Message
- func (c *Client) SendNotify(route string, data []byte) error
- func (c *Client) SendRequest(route string, data []byte) (uint, error)
- func (c *Client) SetClientHandshakeData(data *packet.HandshakeData)
- type Command
- type HandshakeData
- type HandshakeSys
- type PitayaClient
- type ProtoBufferInfo
- type ProtoClient
- func (pc *ProtoClient) AddPushResponse(route string, protoName string)
- func (pc *ProtoClient) ConnectTo(addr string, tlsConfig ...*tls.Config) error
- func (pc *ProtoClient) Disconnect()
- func (pc *ProtoClient) ExportInformation() *ProtoBufferInfo
- func (pc *ProtoClient) LoadInfo(info *ProtoBufferInfo) error
- func (pc *ProtoClient) LoadServerInfo(addr string) error
- func (pc *ProtoClient) MsgChannel() chan *message.Message
- func (pc *ProtoClient) SendNotify(route string, data []byte) error
- func (pc *ProtoClient) SendRequest(route string, data []byte) (uint, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Connected bool IncomingMsgChan chan *message.Message // contains filtered or unexported fields }
Client struct
func (*Client) ConnectTo ¶
ConnectTo connects to the server at addr, for now the only supported protocol is tcp if tlsConfig is sent, it connects using TLS
func (*Client) ConnectToWS ¶
ConnectToWS connects using webshocket protocol
func (*Client) ConnectedStatus ¶
ConnectedStatus return the connection status
func (*Client) MsgChannel ¶
MsgChannel return the incoming message channel
func (*Client) SendNotify ¶
SendNotify sends a notify to the server
func (*Client) SendRequest ¶
SendRequest sends a request to the server
func (*Client) SetClientHandshakeData ¶
func (c *Client) SetClientHandshakeData(data *packet.HandshakeData)
SetClientHandshakeData sets the data to send inside handshake
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command struct. Save the input and output type and proto descriptor for each one.
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 PitayaClient ¶
type PitayaClient interface { ConnectTo(addr string, tlsConfig ...*tls.Config) error ConnectToWS(addr string, path string, tlsConfig ...*tls.Config) error ConnectedStatus() bool Disconnect() MsgChannel() chan *message.Message SendNotify(route string, data []byte) error SendRequest(route string, data []byte) (uint, error) SetClientHandshakeData(data *packet.HandshakeData) }
PitayaClient iface
type ProtoBufferInfo ¶
ProtoBufferInfo save all commands from a server.
type ProtoClient ¶
type ProtoClient struct { Client IncomingMsgChan chan *message.Message // contains filtered or unexported fields }
ProtoClient struct
func NewWithDescriptor ¶
func NewWithDescriptor(descriptorsRoute string, docsRoute string, logLevel slog.Level, requestTimeout ...time.Duration) *ProtoClient
NewWithDescriptor returns a new protoClient with the descriptors route and auto documentation route.
func (*ProtoClient) AddPushResponse ¶
func (pc *ProtoClient) AddPushResponse(route string, protoName string)
AddPushResponse add a push response. Must be ladded before LoadInfo.
func (*ProtoClient) ConnectTo ¶
func (pc *ProtoClient) ConnectTo(addr string, tlsConfig ...*tls.Config) error
ConnectTo connects to the server at addr, for now the only supported protocol is tcp this methods blocks as it also handles the messages from the server
func (*ProtoClient) ExportInformation ¶
func (pc *ProtoClient) ExportInformation() *ProtoBufferInfo
ExportInformation export supported server commands information
func (*ProtoClient) LoadInfo ¶
func (pc *ProtoClient) LoadInfo(info *ProtoBufferInfo) error
LoadInfo load commands information form ProtoBufferInfo
func (*ProtoClient) LoadServerInfo ¶
func (pc *ProtoClient) LoadServerInfo(addr string) error
LoadServerInfo load commands information from the server. Addr is the server address.
func (*ProtoClient) MsgChannel ¶
func (pc *ProtoClient) MsgChannel() chan *message.Message
MsgChannel return the incoming message channel
func (*ProtoClient) SendNotify ¶
func (pc *ProtoClient) SendNotify(route string, data []byte) error
SendNotify sends a notify to the server
func (*ProtoClient) SendRequest ¶
func (pc *ProtoClient) SendRequest(route string, data []byte) (uint, error)
SendRequest sends a request to the server