clientGo

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

RWeb Go语言客户端

作为Go语言客户端,本实现利用了反射的能力。

如果你需要绑定函数,你可以有两种绑定方式:

第一个参数为*Replier

或者 全部按照规定的参数,通过client.R()获取Replier

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindFunction

type BindFunction interface{}

type RWebsocketClient

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

The first

func NewRWebsocketClient

func NewRWebsocketClient(Address string) (ret RWebsocketClient, _ error)

func (*RWebsocketClient) Bind

func (z *RWebsocketClient) Bind(FunctionName string, Function BindFunction) error

func (*RWebsocketClient) Call

func (z *RWebsocketClient) Call(FunctionName string, Arguments ...interface{}) (interface{}, error)

Call 调用客户端函数 阻塞

func (*RWebsocketClient) CallNotWait added in v0.0.17

func (z *RWebsocketClient) CallNotWait(FunctionName string, Arguments ...interface{}) error

CallNotWait 不等待回复

type Replier

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

func R

func R() *Replier

func (*Replier) Call

func (z *Replier) Call(FunctionName string, Arguments ...interface{}) (interface{}, error)

func (*Replier) Reply

func (z *Replier) Reply(Data interface{}) error

type StandardCall

type StandardCall struct {
	Function string          `json:"function"`
	Argument []interface{}   `json:"argument"`
	Id       jsoniter.Number `json:"id"`
	IsReply  bool            `json:"reply"` //只是保留,客户端不需要实现 若为Reply时,需要设置为true
}

type StandardReply

type StandardReply struct {
	Id    jsoniter.Number `json:"id"`
	Data  interface{}     `json:"data"`
	Reply bool            `json:"reply"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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