/// <summary>Check or create instance.</summary>
 private static void CheckOrCreateInstance()
 {
     if (_instance == null)
     {
         _instance = new WebsocketManager();
     }
 }
        /// <summary>Process the keepalives.</summary>
        /// <param name="currentTicks">The current ticks.</param>
        /// <param name="timeString">  The time string.</param>
        public static void ProcessKeepalives(long currentTicks, string timeString)
        {
            List <Guid> clientsToRemove = new List <Guid>();

            // traverse the dictionary looking for clients we need to send messages to
            foreach (KeyValuePair <Guid, long> kvp in _instance._clientsAndTimeouts)
            {
                // check timeout
                if (currentTicks > kvp.Value)
                {
                    // enqueue a message for this client
                    if (WebsocketManager.TryGetClient(kvp.Key, out WebsocketClientInformation client))
                    {
                        // enqueue a keepalive message
                        client.MessageQ.Enqueue($"keepalive {timeString}");
                    }
                    else
                    {
                        // client is gone, stop sending (cannot remove inside iterator)
                        clientsToRemove.Add(kvp.Key);
                    }
                }
            }

            if (clientsToRemove.Count > 0)
            {
                foreach (Guid clientGuid in clientsToRemove)
                {
                    _instance._clientsAndTimeouts.TryRemove(clientGuid, out _);
                }
            }
        }