private void OnTcpClientDisconnected(Guid oldConnectionID)
{
if (oldConnectionID == ConnectionId)
{
var itemsToSend = MessageQueue.ToList();
ActiveConnection = null;
if (!IsOnline) return;
IsOnline = false;
OnDisconnected?.Invoke(this);
if (_pushNotificationSender != null)
{
foreach (var item in itemsToSend)
{
_pushNotificationSender.SendNotification(item.SerializedMessage);
}
}
}
}