client

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

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 New

func New(logLevel logrus.Level, requestTimeout ...time.Duration) *Client

New returns a new client

func (*Client) ConnectTo

func (c *Client) ConnectTo(addr string) 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 (*Client) ConnectToTLS added in v0.7.6

func (c *Client) ConnectToTLS(addr string, skipVerify bool) error

ConnectToTLS connects to the server at addr using TLS, for now the only supported protocol is tcp this methods blocks as it also handles the messages from the server

func (*Client) ConnectedStatus added in v0.7.6

func (c *Client) ConnectedStatus() bool

ConnectedStatus return the connection status

func (*Client) Disconnect

func (c *Client) Disconnect()

Disconnect disconnects the client

func (*Client) MsgChannel added in v0.7.6

func (c *Client) MsgChannel() chan *message.Message

MsgChannel return the incoming message channel

func (*Client) SendNotify

func (c *Client) SendNotify(route string, data []byte) error

SendNotify sends a notify to the server

func (*Client) SendRequest

func (c *Client) SendRequest(route string, data []byte) (uint, error)

SendRequest sends a request to the server

type Command added in v0.7.6

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 added in v0.7.6

type PitayaClient interface {
	ConnectTo(addr string) error
	ConnectToTLS(addr string, skipVerify bool) error
	Disconnect()
	SendNotify(route string, data []byte) error
	SendRequest(route string, data []byte) (uint, error)
	ConnectedStatus() bool
	MsgChannel() chan *message.Message
}

type ProtoBufferInfo added in v0.7.6

type ProtoBufferInfo struct {
	Commands map[string]*Command
}

ProtoBufferInfo save all commands from a server.

type ProtoClient added in v0.7.6

type ProtoClient struct {
	Client

	IncomingMsgChan chan *message.Message
	// contains filtered or unexported fields
}

ProtoClient struct

func NewProto added in v0.7.6

func NewProto(docsRoute string, docslogLevel logrus.Level, requestTimeout ...time.Duration) *ProtoClient

NewProto returns a new protoclient with the auto documentation route.

func NewWithDescriptor added in v0.7.6

func NewWithDescriptor(descriptorsRoute string, docsRoute string, docslogLevel logrus.Level, requestTimeout ...time.Duration) *ProtoClient

NewWithDescriptor returns a new protoclient with the descriptors route and auto documentation route.

func (*ProtoClient) AddPushResponse added in v0.7.6

func (pc *ProtoClient) AddPushResponse(route string, protoName string)

AddPushResponse add a push response. Must be ladded before LoadInfo.

func (*ProtoClient) ConnectTo added in v0.7.6

func (pc *ProtoClient) ConnectTo(addr string) 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) ConnectToTLS added in v0.7.6

func (pc *ProtoClient) ConnectToTLS(addr string, skipVerify bool) error

ConnectToTLS connects to the server at addr using TLS, for now the only supported protocol is tcp this methods blocks as it also handles the messages from the server

func (*ProtoClient) Disconnect added in v0.7.6

func (pc *ProtoClient) Disconnect()

Disconnect the client

func (*ProtoClient) ExportInformation added in v0.7.6

func (pc *ProtoClient) ExportInformation() *ProtoBufferInfo

ExportInformation export supported server commands information

func (*ProtoClient) LoadInfo added in v0.7.6

func (pc *ProtoClient) LoadInfo(info *ProtoBufferInfo) error

LoadInfo load commands information form ProtoBufferInfo

func (*ProtoClient) LoadServerInfo added in v0.7.6

func (pc *ProtoClient) LoadServerInfo(addr string) error

LoadServerInfo load commands information from the server. Addr is the server address.

func (*ProtoClient) MsgChannel added in v0.7.6

func (pc *ProtoClient) MsgChannel() chan *message.Message

MsgChannel return the incoming message channel

func (*ProtoClient) SendNotify added in v0.7.6

func (pc *ProtoClient) SendNotify(route string, data []byte) error

SendNotify sends a notify to the server

func (*ProtoClient) SendRequest added in v0.7.6

func (pc *ProtoClient) SendRequest(route string, data []byte) (uint, error)

SendRequest sends a request to the server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL