connector

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 12 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, 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. It also handles gzip 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