util

package
v0.0.0-...-0786c74 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooManyEmptyStreamMessages = errors.New("stream has sent too many empty messages")
)

Functions

func HttpGet

func HttpGet(ctx context.Context, url string, header map[string]string, data g.Map, result interface{}, proxyURL string) ([]byte, error)

func HttpPost

func HttpPost(ctx context.Context, url string, header map[string]string, data, result interface{}, proxyURL string) ([]byte, error)

Types

type RequestErrorHandler

type RequestErrorHandler func(ctx context.Context, response *gclient.Response) (err error)

type StreamReader

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

func SSEClient

func SSEClient(ctx context.Context, url string, header map[string]string, data interface{}, proxyURL string, requestErrorHandler RequestErrorHandler) (stream *StreamReader, err error)

func (*StreamReader) Close

func (stream *StreamReader) Close() error

func (*StreamReader) Recv

func (stream *StreamReader) Recv() (response []byte, err error)

type WebSocketConn

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

func WebSocketClient

func WebSocketClient(ctx context.Context, wsURL string, requestHeader http.Header, messageType int, message []byte, proxyURL string) (*WebSocketConn, error)

func (*WebSocketConn) Close

func (c *WebSocketConn) Close() (err error)

func (*WebSocketConn) ReadMessage

func (c *WebSocketConn) ReadMessage(ctx context.Context) (int, []byte, error)

func (*WebSocketConn) WriteJSON

func (c *WebSocketConn) WriteJSON(ctx context.Context, message interface{}) error

func (*WebSocketConn) WriteMessage

func (c *WebSocketConn) WriteMessage(ctx context.Context, messageType int, message []byte) error

Jump to

Keyboard shortcuts

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