engine/websocket: subscribe to default channels only when actually needed (#610)

* if this is required by ws routines or sync manager
* restore previous subscriptions on reconnect
This commit is contained in:
Rauno Ots
2020-12-29 02:10:37 +01:00
committed by GitHub
parent b95cfaccab
commit d1b206c45b
24 changed files with 75 additions and 146 deletions

View File

@@ -40,12 +40,8 @@ func (b *Bitstamp) WsConnect() error {
if err != nil {
b.Websocket.DataHandler <- err
}
subs, err := b.generateDefaultSubscriptions()
if err != nil {
return err
}
go b.wsReadData()
return b.Websocket.SubscribeToChannels(subs)
return nil
}
// wsReadData receives and passes on websocket messages for processing