client

package
v0.0.0-...-055e899 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 11 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 {
	// contains filtered or unexported fields
}

Client interacts with the game server, including establishing connection to server, reading data from server and writing data to server etc.

TODO: Add heartbeating mechanism (eg., ping/pong) so that client can detect connection disruption especially for UDP protocol.

func NewTCPClient

func NewTCPClient(addr string) *Client

func NewUDPClient

func NewUDPClient(addr string) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) Connect

func (c *Client) Connect() error

func (*Client) GenerateRandomNickname

func (c *Client) GenerateRandomNickname(sex, culture int32) error

func (*Client) Info

func (c *Client) Info() error

func (*Client) Login

func (c *Client) Login(username, password string) error

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) OnMessage

func (c *Client) OnMessage(cb OnMessageCallback)

type OnMessageCallback

type OnMessageCallback func(msg *proto.Message)

Jump to

Keyboard shortcuts

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