binance: emit reconnect when received ListenKeyExpired

This commit is contained in:
c9s 2022-09-11 14:11:50 +08:00
parent ff635195fb
commit f2e3acf8ec
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -127,6 +127,9 @@ func NewStream(ex *Exchange, client *binance.Client, futuresClient *futures.Clie
stream.OnOrderTradeUpdateEvent(stream.handleOrderTradeUpdateEvent)
stream.OnDisconnect(stream.handleDisconnect)
stream.OnConnect(stream.handleConnect)
stream.OnListenKeyExpired(func(e *ListenKeyExpired) {
stream.Reconnect()
})
return stream
}
@ -368,7 +371,7 @@ func (s *Stream) dispatchEvent(e interface{}) {
case *ListenKeyExpired:
s.EmitListenKeyExpired(e)
}
}