private int RetrieveNotification(out WoopsaClientNotifications notificationsResult, int lastNotificationId)
{
WoopsaJsonData results = WaitNotification(_subscriptionOpenChannel.Value, lastNotificationId);
var notificationsList = new WoopsaClientNotifications();
int count = 0;
for (int i = 0; i < results.Length; i++)
{
WoopsaJsonData notification = results[i];
var notificationValue = notification["Value"];
var notificationSubscriptionId = notification["SubscriptionId"];
var notificationId = notification["Id"];
WoopsaValueType type = (WoopsaValueType)Enum.Parse(typeof(WoopsaValueType), notificationValue["Type"]);
WoopsaValue value = WoopsaValue.CreateChecked(notificationValue["Value"], type, DateTime.Parse(notificationValue["TimeStamp"]));
WoopsaClientNotification newNotification = new WoopsaClientNotification(value, notificationSubscriptionId);
newNotification.Id = notificationId;
notificationsList.Add(newNotification);
count++;
}
notificationsResult = notificationsList;
return count;
}