websocket

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn interface {
	Run(ctx context.Context) error
	Close() error
	Error() error
	Done() <-chan struct{}
	Subscribe(ctx context.Context, channels ...exchange.Channel) error
	UnSubscribe(ctx context.Context, channels ...exchange.Channel) error
}

Conn Unique exchange websocket client

type Gen

type Gen interface {
	NewConn(ctx context.Context) (Conn, error)
	//Channel return channels which need to be subscribe.
	Channels(ctx context.Context, oldChannel []exchange.Channel) (newChannels []exchange.Channel, notify chan struct{}, err error)
}

Gen is a interface for unify rpc connection and update subscription channel

type Keeper

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

Keeper is a struct which used to make websocket connection auto reconnect and auto update subscribe channels

func NewKeeper

func NewKeeper(gen Gen) *Keeper

func (*Keeper) Done

func (k *Keeper) Done() chan struct{}

func (*Keeper) ECh

func (k *Keeper) ECh() chan error

ECh push error when error happen

func (*Keeper) Loop

func (k *Keeper) Loop(ctx context.Context)

Jump to

Keyboard shortcuts

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