Added Twitch exponential backoff for reconnecting.

This commit is contained in:
Tom 2024-08-12 17:55:28 +00:00
parent 6810132dde
commit 693a448972
2 changed files with 3 additions and 1 deletions

View File

@ -98,7 +98,7 @@ namespace TwitchChatTTS.Twitch.Socket
if (reconnecting) if (reconnecting)
{ {
var newClient = GetWorkingClient(); var newClient = GetWorkingClient();
await newClient.Connect(); await newClient.Reconnect();
} }
} }

View File

@ -122,6 +122,8 @@ namespace TwitchChatTTS.Twitch.Socket
await ConnectAsync(URL); await ConnectAsync(URL);
} }
public async Task Reconnect() => await Reconnect(_backoff, async () => await Connect());
public void Identify(string sessionId) public void Identify(string sessionId)
{ {
Identified = true; Identified = true;