reconnect method
void
reconnect()
Force reconnect -- closes the existing connection and starts a new one.
Useful when the subscription becomes stale (e.g. after container shutdown).
Implementation
void reconnect() {
_reconnectAttempts = 0;
_sessionNotFoundRetries = 0;
close();
// Small delay before reconnecting (stored so it can be cancelled).
_reconnectTimer = Timer(
const Duration(milliseconds: 500),
() {
_reconnectTimer = null;
connect();
},
);
}