Skip to content

Commit feb9b1b

Browse files
committed
Fix incrementing reconnection attempts
1 parent e406c92 commit feb9b1b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Packages/StreamVideo/Runtime/Core/LowLevelClient/ReconnectScheduler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ private void TryScheduleNextReconnectTime()
151151
}
152152

153153
NextReconnectTime = GetNextReconnectTime();
154+
_reconnectAttempts++;
154155
}
155156

156157
private void OnConnectionStateChanged(ConnectionState previous, ConnectionState current)

Packages/StreamVideo/Runtime/Core/LowLevelClient/WebSockets/BasePersistentWebSocket.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public async Task DisconnectAsync(WebSocketCloseStatus closeStatus, string close
109109
}
110110

111111
ConnectionState = ConnectionState.Disconnecting;
112-
112+
113113
await OnDisconnectingAsync(closeMessage);
114114

115115
if (WebsocketClient == null)
@@ -342,6 +342,11 @@ private TEvent DeserializeEvent<TDto, TEvent>(string content, out TDto dto)
342342

343343
private void OnReconnectionScheduled()
344344
{
345+
if (!NextReconnectTime.HasValue)
346+
{
347+
throw new ArgumentNullException(nameof(NextReconnectTime));
348+
}
349+
345350
ConnectionState = ConnectionState.WaitToReconnect;
346351
var timeLeft = NextReconnectTime.Value - TimeService.Time;
347352

0 commit comments

Comments
 (0)