public WoopsaJsonData WaitNotification(int subscriptionChannel, int lastNotificationId) { int channelId = subscriptionChannel; int notificationId = lastNotificationId; WoopsaSubscriptionChannel channel; lock (_channels) if (_channels.ContainsKey(channelId)) { channel = _channels[channelId]; } else { channel = null; } if (channel != null) { IWoopsaNotifications notifications = channel.WaitNotification(WoopsaSubscriptionServiceConst.WaitNotificationTimeout, notificationId); return(WoopsaJsonData.CreateFromText(notifications.Serialize())); } else { throw new WoopsaInvalidSubscriptionChannelException(string.Format("Tried to call WaitNotification on channel with id={0} that does not exist", channelId)); } }