I’m using the spot code as a base, but it’s not the same logic, see:
-
Connect to the websocket
-
u of the snapshot: 8058369969964
-
Save this snapshot as the local workbook
-
Drop any event where
u
is <lastUpdateId
in the snapshot. -
The first processed event should have
U
<=
lastUpdateId** AND **
u>
=lastUpdateId
After completing steps 4 and 5, the event buffer was cleared, leaving only the snapshot and the initial event.
- While listening to the stream, each new event’s
pu
should be equal to the previous event’su
. Otherwise, initialize the process from step 3.
In the next event, the pu is: 8058369966560, which is different from the local orderbook (8058369969964), thus generating infinite retries.