client

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package client 客户端接口定义 client

Package client grpc 客户端

Package client http 客户端

Package client webSocket 客户端

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(url, protocol, origin string, httpHeader map[string]string) (ws *websocket.Conn, err error)

Dial opens a new client connection to a WebSocket. 复写 websocket库的 Dial 方法 ,增加 httpheader 设置功能

func HTTPRequest

func HTTPRequest(chanID uint64, request *model.Request) (resp *http.Response, requestTime uint64, err error)

HTTPRequest HTTP 请求 method 方法 GET POST url 请求的url body 请求的body headers 请求头信息 timeout 请求超时时间

Types

type Clienter

type Clienter interface {
	GetConn() (err error)
	Send()
	Close() (err error)
}

Clienter 接口 获取连接、发送数据、关闭 等

type GrpcSocket

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

GrpcSocket grpc

func NewGrpcSocket

func NewGrpcSocket(address string) (s *GrpcSocket)

NewGrpcSocket new

func (*GrpcSocket) Close

func (g *GrpcSocket) Close() (err error)

Close 关闭

func (*GrpcSocket) GetConn

func (g *GrpcSocket) GetConn() (conn *grpc.ClientConn)

GetConn 获取连接

func (g *GrpcSocket) Link() (err error)

Link 建立连接

type WebSocket

type WebSocket struct {
	URLLink    string
	URL        *url.URL
	IsSsl      bool
	HTTPHeader map[string]string
	// contains filtered or unexported fields
}

WebSocket webSocket

func NewWebSocket

func NewWebSocket(urlLink string) (ws *WebSocket)

NewWebSocket new

func (*WebSocket) Close

func (w *WebSocket) Close() (err error)

Close 关闭

func (*WebSocket) GetConn

func (w *WebSocket) GetConn() (err error)

GetConn 获取连接

func (*WebSocket) Read

func (w *WebSocket) Read() (msg []byte, err error)

Read 接收数据

func (*WebSocket) SetHeader

func (w *WebSocket) SetHeader(head map[string]string)

SetHeader 设置 header

func (*WebSocket) Write

func (w *WebSocket) Write(body []byte) (err error)

Write 发送数据

Directories

Path Synopsis
Package httplongclinet Keepalive
Package httplongclinet Keepalive

Jump to

Keyboard shortcuts

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