I have set up a WebJob that sends a notification to a NotificationHub every minute for test purposes and I would need it to send multiple notifications instead of just the one.
I have tried to just send an array of Notification objects instead of just the one object but this doesn't seem to work.
Function.cs
public class Functions
{
// This function will get triggered/executed when a new message is written
// on an Azure Queue called queue.
public static void SendNotif1([TimerTrigger("0 * * * * *")] TimerInfo time, TextWriter log, [NotificationHub] out Notification notification)
{
string title = "Hello";
string message = "Message";
notification = new GcmNotification(ToGcmPayload(title, message));
}
private static string ToGcmPayload(string title, string message)
{
var gcmPayloadModel = new
{
data = new
{
FormType = "Next scheduler",
MemberForm = "Hello"
}
};
return JsonConvert.SerializeObject(gcmPayloadModel);
}
}
Am I trying to do this the wrong way ?