@parse/push-adapter 6.4.1 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/package.json +11 -11
- package/src/FCM.js +13 -1
package/README.md
CHANGED
|
@@ -19,8 +19,10 @@ The official Push Notification adapter for Parse Server. See [Parse Server Push
|
|
|
19
19
|
- [Configure Parse Server](#configure-parse-server)
|
|
20
20
|
- [Apple Push Options](#apple-push-options)
|
|
21
21
|
- [Android Push Options](#android-push-options)
|
|
22
|
+
- [Firebase Cloud Messaging (FCM)](#firebase-cloud-messaging-fcm)
|
|
22
23
|
- [Google Cloud Service Account Key](#google-cloud-service-account-key)
|
|
23
24
|
- [Migration to FCM HTTP v1 API (June 2024)](#migration-to-fcm-http-v1-api-june-2024)
|
|
25
|
+
- [HTTP/1.1 Legacy Option](#http11-legacy-option)
|
|
24
26
|
- [Expo Push Options](#expo-push-options)
|
|
25
27
|
- [Bundled with Parse Server](#bundled-with-parse-server)
|
|
26
28
|
- [Logging](#logging)
|
|
@@ -110,6 +112,10 @@ android: {
|
|
|
110
112
|
}
|
|
111
113
|
```
|
|
112
114
|
|
|
115
|
+
### Firebase Cloud Messaging (FCM)
|
|
116
|
+
|
|
117
|
+
This section contains some considerations when using FCM, regardless of the destination ecosystems the push notification is sent to.
|
|
118
|
+
|
|
113
119
|
#### Google Cloud Service Account Key
|
|
114
120
|
|
|
115
121
|
The Firebase console allows to easily create and download a Google Cloud service account key JSON file with the required permissions. Instead of setting `firebaseServiceAccount` to the path of the JSON file, you can provide an object representing a Google Cloud service account key:
|
|
@@ -139,6 +145,19 @@ android: {
|
|
|
139
145
|
}
|
|
140
146
|
```
|
|
141
147
|
|
|
148
|
+
#### HTTP/1.1 Legacy Option
|
|
149
|
+
|
|
150
|
+
With the introduction of the FCM HTTP v1 API, support for HTTP/2 was added which provides faster throughput for push notifications. To use the older version HTTP/1.1 set `fcmEnableLegacyHttpTransport: true` in your push options.
|
|
151
|
+
|
|
152
|
+
Example options:
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
android: {
|
|
156
|
+
firebaseServiceAccount: __dirname + '/firebase.json',
|
|
157
|
+
fcmEnableLegacyHttpTransport: true
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
142
161
|
### Expo Push Options
|
|
143
162
|
|
|
144
163
|
Example options:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parse/push-adapter",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "Base parse-server-push-adapter",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,28 +24,28 @@
|
|
|
24
24
|
"author": "Parse",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@parse/node-apn": "6.0
|
|
27
|
+
"@parse/node-apn": "6.2.0",
|
|
28
28
|
"@parse/node-gcm": "1.0.2",
|
|
29
|
-
"expo-server-sdk": "3.
|
|
30
|
-
"firebase-admin": "12.
|
|
29
|
+
"expo-server-sdk": "3.11.0",
|
|
30
|
+
"firebase-admin": "12.5.0",
|
|
31
31
|
"npmlog": "7.0.1",
|
|
32
|
-
"parse": "5.
|
|
32
|
+
"parse": "5.3.0",
|
|
33
33
|
"web-push": "3.6.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@eslint/js": "9.
|
|
36
|
+
"@eslint/js": "9.11.1",
|
|
37
37
|
"@semantic-release/changelog": "6.0.3",
|
|
38
38
|
"@semantic-release/commit-analyzer": "13.0.0",
|
|
39
39
|
"@semantic-release/git": "10.0.1",
|
|
40
|
-
"@semantic-release/github": "
|
|
40
|
+
"@semantic-release/github": "11.0.0",
|
|
41
41
|
"@semantic-release/npm": "12.0.1",
|
|
42
42
|
"@semantic-release/release-notes-generator": "14.0.1",
|
|
43
43
|
"c8": "10.1.2",
|
|
44
|
-
"codecov": "3.8.
|
|
45
|
-
"eslint": "9.
|
|
46
|
-
"jasmine": "5.
|
|
44
|
+
"codecov": "3.8.3",
|
|
45
|
+
"eslint": "9.11.1",
|
|
46
|
+
"jasmine": "5.3.0",
|
|
47
47
|
"jasmine-spec-reporter": "7.0.0",
|
|
48
|
-
"semantic-release": "24.
|
|
48
|
+
"semantic-release": "24.1.1"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": "18 || 20 || 22"
|
package/src/FCM.js
CHANGED
|
@@ -25,14 +25,26 @@ export default function FCM(args, pushType) {
|
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
const fcmEnableLegacyHttpTransport = typeof args.fcmEnableLegacyHttpTransport === 'boolean'
|
|
29
|
+
? args.fcmEnableLegacyHttpTransport
|
|
30
|
+
: false;
|
|
31
|
+
|
|
28
32
|
let app;
|
|
29
33
|
if (getApps().length === 0) {
|
|
30
34
|
app = initializeApp({ credential: cert(args.firebaseServiceAccount) });
|
|
31
35
|
} else {
|
|
32
36
|
app = getApp();
|
|
33
37
|
}
|
|
38
|
+
|
|
34
39
|
this.sender = getMessaging(app);
|
|
35
|
-
|
|
40
|
+
|
|
41
|
+
if (fcmEnableLegacyHttpTransport) {
|
|
42
|
+
this.sender.enableLegacyHttpTransport();
|
|
43
|
+
log.warn(LOG_PREFIX, 'Legacy HTTP/1.1 transport is enabled. This is a deprecated feature and support for this flag will be removed in the future.');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Push type is only used to remain backwards compatible with APNS and GCM
|
|
47
|
+
this.pushType = pushType;
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
FCM.FCMRegistrationTokensMax = FCMRegistrationTokensMax;
|