mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-16 23:16:48 +00:00
bithumb: Add websocket support (#745)
* bithumb: Add websocket support (WIP) * bithumb: cont impl. * bithumb: finish, issues with orderbook needs review * linter issues * bithumb: move to separate file * bithumb: change to pointer for book * bithumb: Add tests * bithumb: Address nits * websocket: Export subscription error and wrap returns * bithumb: cleanup/ fix tests * gctrpc/bithumb: fix misspelling * bithumb: gofmt * readme: update support table, regen doc * tradesReadme: update * readme: update template
This commit is contained in:
@@ -23,7 +23,11 @@ const (
|
||||
defaultTrafficPeriod = time.Second
|
||||
)
|
||||
|
||||
var errClosedConnection = errors.New("use of closed network connection")
|
||||
var (
|
||||
errClosedConnection = errors.New("use of closed network connection")
|
||||
// ErrSubscriptionFailure defines an error when a subscription fails
|
||||
ErrSubscriptionFailure = errors.New("subscription failure")
|
||||
)
|
||||
|
||||
// New initialises the websocket struct
|
||||
func New() *Websocket {
|
||||
@@ -210,7 +214,7 @@ func (w *Websocket) Connect() error {
|
||||
if len(w.subscriptions) != 0 {
|
||||
err = w.Subscriber(w.subscriptions)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%v Error subscribing %s", w.exchangeName, err)
|
||||
return fmt.Errorf("%v %w: %v", w.exchangeName, ErrSubscriptionFailure, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -836,7 +840,11 @@ func (w *Websocket) SubscribeToChannels(channels []ChannelSubscription) error {
|
||||
}
|
||||
}
|
||||
}
|
||||
return w.Subscriber(channels)
|
||||
err := w.Subscriber(channels)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%v %w: %v", w.exchangeName, ErrSubscriptionFailure, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddSuccessfulSubscriptions adds subscriptions to the subscription lists that
|
||||
|
||||
Reference in New Issue
Block a user