io

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT 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 Connector

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

Connector is a tiny Nano client

func NewConnector

func NewConnector() *Connector

NewConnector create a new Connector

func (*Connector) Close

func (c *Connector) Close()

Close close the connection, and shutdown the benchmark

func (*Connector) Notify

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

Notify send a notification to server

func (*Connector) On

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

On add the callback for the event

func (*Connector) OnConnected

func (c *Connector) OnConnected(callback func())

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

func (*Connector) Request

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

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

func (*Connector) Start

func (c *Connector) 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