client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(data interface{})

Callback represents the callback type which will be called when the correspond events is occurred.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a tiny Ngs client

func NewClient

func NewClient() *Client

NewClient create a new Client

func (*Client) Close

func (c *Client) Close()

Close the connection, and shutdown the benchmark

func (*Client) Notify

func (c *Client) Notify(route string, v proto.Message) error

Notify send a notification to server

func (*Client) On

func (c *Client) On(event string, callback Callback)

On add the callback for the event

func (*Client) OnConnected

func (c *Client) OnConnected(callback func())

OnConnected set the callback which will be called when the client connected to the server

func (*Client) Request

func (c *Client) Request(route string, v proto.Message, callback Callback) error

Request send a request to server and register a callback for the response

func (*Client) Start

func (c *Client) Start(addr string) error

Start connect to the server and send/recv between the c/s

Jump to

Keyboard shortcuts

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