@@ -493,24 +493,29 @@ func (c *Client) checkResubscription(socketId SocketId) {
493493 if c .parameters .ManageOrderbook {
494494 ctx , cancel := context .WithTimeout (context .Background (), time .Second * 5 )
495495 defer cancel ()
496- _ , err_flag := c .EnableFlag (ctx , common .Checksum )
497- if err_flag != nil {
498- c .log .Errorf ("could not enable checksum flag %s " , err_flag )
496+ req := & FlagRequest {
497+ Event : "conf" ,
498+ Flags : common .Checksum ,
499+ }
500+ if err := socket .Asynchronous .Send (ctx , req ); err != nil {
501+ c .log .Errorf ("socket(%d) could not enable checksum flag %s " , socket .Id , err )
499502 }
500503 }
504+
501505 if c .parameters .ResubscribeOnReconnect && socket .ResetSubscriptions != nil {
506+ ctx , cancel := context .WithTimeout (context .Background (), time .Second * 10 )
507+ defer cancel ()
502508 for _ , sub := range socket .ResetSubscriptions {
503509 if sub .Request .Event == "auth" {
504510 continue
505511 }
506- ctx , cancel := context .WithTimeout (context .Background (), time .Second * 5 )
507- defer cancel ()
508512 sub .Request .SubID = c .nonce .GetNonce () // new nonce
509513 c .log .Infof ("socket (id=%d) resubscribing to %s with nonce %s" , socket .Id , sub .Request .String (), sub .Request .SubID )
510514 _ , err := c .subscribeBySocket (ctx , socket , sub .Request )
511515 if err != nil {
512516 c .log .Errorf ("could not resubscribe: %s" , err .Error ())
513517 }
518+ time .Sleep (50 * time .Millisecond )
514519 }
515520 socket .ResetSubscriptions = nil
516521 }
0 commit comments