connector

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type REST

type REST struct {
	HTTPClient *http.Client
}

REST is for REST connection.

func GetREST

func GetREST() (*REST, error)

GetREST returns already initialized http client.

func InitREST

func InitREST(cfg *config.REST) *REST

InitREST initializes http client with configured values.

func (*REST) Do

func (r *REST) Do(req *http.Request) (*http.Response, error)

Do makes GET http call to exchange.

func (*REST) Request

func (r *REST) Request(appCtx context.Context, method, url string) (*http.Request, error)

Request creates a new request object for http operation.

type Websocket

type Websocket struct {
	Conn net.Conn
	Cfg  *config.WS
}

Websocket is for websocket connection.

func NewWebsocket

func NewWebsocket(appCtx context.Context, cfg *config.WS, url string) (Websocket, error)

NewWebsocket creates a new websocket connection for the exchange.

func (*Websocket) Read

func (w *Websocket) Read() ([]byte, error)

Read reads data frame from websocket connection.

func (*Websocket) ReadTextOrFlateBinary added in v1.5.0

func (w *Websocket) ReadTextOrFlateBinary() ([]byte, error)

ReadTextOrFlateBinary reads data frame from websocket connection. It also handles flate compressed binary data frame.

func (*Websocket) ReadTextOrGzipBinary added in v1.4.0

func (w *Websocket) ReadTextOrGzipBinary() ([]byte, error)

ReadTextOrGzipBinary reads data frame from websocket connection. It also handles gzip compressed binary data frame.

func (*Websocket) ReadTextOrZlibBinary added in v1.4.0

func (w *Websocket) ReadTextOrZlibBinary() ([]byte, error)

ReadTextOrZlibBinary reads data frame from websocket connection. It also handles zlib compressed binary data frame.

func (*Websocket) Write

func (w *Websocket) Write(data []byte) error

Write writes data frame on websocket connection.

Jump to

Keyboard shortcuts

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