You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-2Lines changed: 57 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,63 @@ This module integrates web push notification services into applications using th
9
9
# Getting Started
10
10
To implement this module in your ABP framework application, @<LexuanZhou> TBD... Ensure to configure the necessary dependencies and integrate the service with your application's frontend and backend.
11
11
12
-
# Contribution
12
+
# Configuration
13
+
Step 1:
14
+
15
+
1. Install the [WebPushNotificationService ABP Framework Module](https://github.com/DecisionTreeTechnology/WebPushNotificationService) from Nuget into your project
16
+
17
+
2. Add DependsOn(typeof(WebPushxxxModule)) attribute to configure the module dependencies.
18
+
19
+
3. Add ```builder.ConfigureWebPush();``` to the OnModelCreating() method in ```MyProjectMigrationsDbContext.cs```.
20
+
21
+
4. Add EF Core migrations and update your database. The service will rely on three table to retrive and push notifications: ```WebPushContents```, ```WebPushSubscriptions``` and ```WebPushNotifications```
22
+
23
+
24
+
Step 2:
25
+
26
+
A pair of VAPID key is needed for the system (what is [VAPID Key](https://stackoverflow.com/questions/40392257/what-is-vapid-and-why-is-it-useful) 🤔). There are multiple ways to generate them.
27
+
28
+
For Angular:
29
+
30
+
- Install the [web-push](https://www.npmjs.com/package/web-push) package from NPM by running ```npm install web-push -g```
31
+
- Generate the vapid keys by running ```web-push generate-vapid-keys [--json]```. An example of a pair of VAPID Keys would be
Set up the configuration by putting the pair of VAPID Keys into your application appsettings.json file. The structure of the key value pair would be as follow:
45
+
46
+
```
47
+
"WebPush": {
48
+
"VapidKeys": {
49
+
"PublicKey": "YOUR-PUBLIC-KEY",
50
+
"PrivateKey": "YOUR-PUBLIC-KEY"
51
+
},
52
+
"Email": "YOUR-EMAIL"
53
+
}
54
+
```
55
+
56
+
# Usuage
57
+
Create a ETO (event trasfer object) and push it to the event bus and it will handle the notification queue under the hood
58
+
```
59
+
var pushNotificationEto =
60
+
new CreateWebPushNotificationEto(CurrentTenant.Id, new List<Guid>{createMessageInput.ToUserId}, createMessageInput.Subject,
0 commit comments