private Task AcknowledgeServerNotificationAsync(ServerNotification notification, NotificationResult result, string customType = null) { _logger.LogInformation("Acknowledging notification {0} of type {1}{2}, result {3}", notification.NotificationId, notification.Type, customType == null ? String.Empty : " - " + customType, result); var acknowledgement = new ClientNotificationWithAcknowledgement { Type = "Acknowledgement", AcknowledgementDetail = new ClientNotificationAcknowledgement { ServerNotificationId = notification.NotificationId, Result = result, SentTime = notification.CreatedOn, Type = notification.Type, CustomNotificationType = customType } }; return QueueClientNotificationAsync(acknowledgement); }
private ClientNotificationWithAcknowledgement CreateMessageReceivedNotification(Message message, ServerNotification serverNotification) { var notification = new ClientNotificationWithAcknowledgement { {"type", "MessageReceived"}, {"senderInternalUserId", message.SenderInternalUserId}, {"messageId", message.MessageId}, {"senderMessageId", message.SenderMessageId}, {"receivedExpired", message.ExpiryTimeStamp.HasValue && message.ExpiryTimeStamp <= DateTime.UtcNow}, {"messageType", message.MessageType}, {"messageScope", message.MessageScope}, {"sentTimestamp", message.SentTimestamp}, {"contextItems", message.ContextItems}, }; notification.AcknowledgementDetail = new ClientNotificationAcknowledgement { Result = NotificationResult.Delivered, ServerNotificationId = serverNotification.NotificationId, SentTime = serverNotification.CreatedOn, Type = serverNotification.Type }; return notification; }