opened
tomasmcguinness
username_0
The NotificationHub binding can be used to send notifications to devices registered within the hub either sending to all, or sending to a specific tag.

NotificationHubs also provide a DirectSend feature, where notifications can be directed at individual devices. This is more desirable when notifications contain individual badge counts for example.

I propose adding a NotificationHubDirectSending binding. With a simple called DirectNotification, it would look something like this:

`[NotificationHubDirectSend(ConnectionStringSetting = "NotificationHub.ConnectionString", HubName = "hubname")] IAsyncCollector<DirectNotification>`

The notifications could then be composed like this

`var apsPayload = new JObject();

apsPayload.Add("badge", "1");
apsPayload.Add("alert", "COMMUTE ALERT!!!");

var payload = new JObject();
payload.Add("aps", apsPayload);

var notification = new AppleNotification(payload.ToString());

var directNotification = new DirectNotification()
{
    Notification = notification,
    DeviceHandle = deviceHandleOrPushToken
};

await notifications.AddAsync(directNotification);`

What do you think?
Support DirectSend in NotificationHub extension
issue
created
tomasmcguinness
username_0
To answer a question from Fabio, the DirectSend functionality is in the NotificationHub SDK. Here is an snippet of the Binding for the IAsyncCollector<DirectNotification>that I propose;

```
 public async Task AddAsync(DirectNotification item, CancellationToken cancellationToken = default(CancellationToken))
 {
            NotificationOutcome notificationOutcome = await _notificationHubclientService.SendDirectNotificationAsync(item.Notification, item.DeviceHandle);
 }
```

I hope that helps.
comment
created
tomasmcguinness
username_0
Do you think this is acceptable? If so, I'll raise a pull request.
comment
created
christopheranderson
username_1
@username_0 - sorry for the delay. Your approach sounds great, including using the NH types. Feel free to send a PR and we'll review it.
comment