tunnel

package
v0.0.0-...-ccde174 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TunnelSubscribe string = "subscribe"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Receiver

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

Receiver connexion

func (*Receiver) Close

func (r *Receiver) Close()

Close shuts down the websocket connection tunnel and logs any close error.

func (*Receiver) Read

func (r *Receiver) Read(ctx context.Context, receiver chan *models.CoinbaseResponse)

Read receives data points from the coinbase and passes them to the receiver channel.

func (*Receiver) Subscribe

func (r *Receiver) Subscribe(tradingPairs []string) error

Subscribe sends a subscribe request to the coinbase channel's websocket, using trading pairs (productIDs).

type Tunnel

type Tunnel interface {
	//Subscribe sends a subscribe request to the coinbase channel's websocket, using trading pairs (productIDs).
	Subscribe(tradingPairs []string) error

	// Read receives data points from the coinbase and passes them to the receiver channel.
	Read(ctx context.Context, receiver chan *models.CoinbaseResponse)

	// Close closes the websocket connection.
	Close()
}

Tunnel is a coinbase websocket stream client to receive data from coinbase websocket server

func NewReceiver

func NewReceiver(websocketUrl string) (Tunnel, error)

NewReceiver initializes a new coinbase Tunnel object and dials the coinbase websocket. It takes a coinbase ws urr, If a connection cannot be reached it returns an error. NewReceiver returns a new websocket client Tunnel.

func NewReceiverWithconn

func NewReceiverWithconn(websocketUrl string, conn *ws.Conn) (Tunnel, error)

NewReceiverWithconn returns a new websocket client.

Jump to

Keyboard shortcuts

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