From c451597ef19a1151363147145120d1ba3a222baa Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Fritz" Date: Wed, 25 Dec 2019 11:21:52 -0500 Subject: [PATCH] Fixed hosted services so they run in the background, added PubSubAuthToken configuration option --- Fritz.Twitch/PubSub/Proxy.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Fritz.Twitch/PubSub/Proxy.cs b/Fritz.Twitch/PubSub/Proxy.cs index cc01b7ec..b1af7f06 100644 --- a/Fritz.Twitch/PubSub/Proxy.cs +++ b/Fritz.Twitch/PubSub/Proxy.cs @@ -20,11 +20,17 @@ public class Proxy : IDisposable { private ClientWebSocket _Socket; private System.Timers.Timer _PingTimer; private System.Timers.Timer _PongTimer; - private readonly ConfigurationSettings _Configuration; - private readonly ILogger _Logger; + private System.Timers.Timer _ReconnectTimer = new System.Timers.Timer(); + private ConfigurationSettings _Configuration; + private ILogger _Logger; private static bool _Reconnect; - public Proxy(IOptions settings, ILoggerFactory loggerFactory) { + private static readonly TimeSpan[] _ReconnectTimeouts = new TimeSpan[] { + TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(30), TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(5) + }; + + public Proxy(IOptions settings, ILoggerFactory loggerFactory) + { InitializeMethodStrategies();