Request 100 additional events. receivedEventCount is not reset to 0 because the code incorrectly setssubscription.receivedEventCount = 0, instead of subscription.info.receivedEventCount = 0
Receive 100 events
At this point, receivedEventCount = 200 and requestedEventCount = 100 so we never hit the if statement again
Close the connection because we received the last event
If you open an infinite connection, it only requests 200 events before closing the connection. The sequence of events is:
receivedEventCount === requestedEventCount
if statement herereceivedEventCount
is not reset to 0 because the code incorrectly setssubscription.receivedEventCount = 0
, instead ofsubscription.info.receivedEventCount = 0
receivedEventCount = 200
andrequestedEventCount = 100
so we never hit the if statement againIncorrect:
Correct: