Skip to content

Commit 80ec12c

Browse files
author
Cory Thompson
committed
Updated README.md to use options.
1 parent 237f2df commit 80ec12c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ var privateKey = @"mryM-krWj_6IsIMGsd8wNFXGBxnx...............";
4040

4141
var subscription = new PushSubscription(pushEndpoint, p256dh, auth);
4242
var vapidDetails = new VapidDetails(subject, publicKey, privateKey);
43-
//var gciApiKey = @"[your key here]";
43+
//var gcmApiKey = @"[your key here]";
4444
4545
var webPushClient = new WebPushClient();
4646
try
4747
{
4848
webPushClient.SendNotification(subscription, "payload", vapidDetails);
49-
//webPushClient.SendNotification(subscription, "payload", gciApiKey);
49+
//webPushClient.SendNotification(subscription, "payload", gcmApiKey);
5050
}
5151
catch (WebPushException exception)
5252
{
@@ -60,14 +60,15 @@ catch (WebPushException exception)
6060

6161
```csharp
6262
var subscription = new PushSubscription(pushEndpoint, p256dh, auth);
63-
var vapidDetails = new VapidDetails(subject, publicKey, privateKey);
64-
//var gciApiKey = @"[your key here]";
63+
64+
var options = new Dictionary<string,object>();
65+
options["vapidDetails"] = new VapidDetails(subject, publicKey, privateKey);
66+
//options["gcmAPIKey"] = @"[your key here]";
6567
6668
var webPushClient = new WebPushClient();
6769
try
6870
{
69-
webPushClient.SendNotification(subscription, "payload", vapidDetails);
70-
//webPushClient.SendNotification(subscription, "payload", gciApiKey);
71+
webPushClient.SendNotification(subscription, "payload", options);
7172
}
7273
catch (WebPushException exception)
7374
{
@@ -102,7 +103,7 @@ any of the following values defined, although none of them are required.
102103

103104
- **gcmAPIKey** can be a GCM API key to be used for this request and this
104105
request only. This overrides any API key set via `setGCMAPIKey()`.
105-
- **vapidDetails** should be an object with *subject*, *publicKey* and
106+
- **vapidDetails** should be a VapidDetails object with *subject*, *publicKey* and
106107
*privateKey* values defined. These values should follow the [VAPID Spec](https://tools.ietf.org/html/draft-thomson-webpush-vapid).
107108
- **TTL** is a value in seconds that describes how long a push message is
108109
retained by the push service (by default, four weeks).

0 commit comments

Comments
 (0)