Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
---
changelog:
- date: 2025-11-19
version: v10.2.2
changes:
- type: improvement
text: "Replace `gcm` with `fcm` for push notification gateway type."
- date: 2025-11-03
version: v10.2.1
changes:
Expand Down Expand Up @@ -1359,7 +1364,7 @@ supported-platforms:
- 'Ubuntu 14.04 and up'
- 'Windows 7 and up'
version: 'Pubnub Javascript for Node'
version: '10.2.1'
version: '10.2.2'
sdks:
- full-name: PubNub Javascript SDK
short-name: Javascript
Expand All @@ -1375,7 +1380,7 @@ sdks:
- distribution-type: source
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/archive/refs/tags/v10.2.1.zip
location: https://github.com/pubnub/javascript/archive/refs/tags/v10.2.2.zip
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down Expand Up @@ -2046,7 +2051,7 @@ sdks:
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub.js
location: https://github.com/pubnub/javascript/releases/download/v10.2.1/pubnub.10.2.1.js
location: https://github.com/pubnub/javascript/releases/download/v10.2.2/pubnub.10.2.2.js
requires:
- name: 'agentkeepalive'
min-version: '3.5.2'
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v10.2.2
November 19 2025

#### Modified
- Replace `gcm` with `fcm` for push notification gateway type.

## v10.2.1
November 03 2025

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
npm install pubnub
```
* or download one of our builds from our CDN:
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.1.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.1.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.2.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.10.2.2.min.js

2. Configure your keys:

Expand Down
6 changes: 3 additions & 3 deletions dist/web/pubnub.js
Original file line number Diff line number Diff line change
Expand Up @@ -5436,7 +5436,7 @@
return base.PubNubFile;
},
get version() {
return '10.2.1';
return '10.2.2';
},
getVersion() {
return this.version;
Expand Down Expand Up @@ -8160,7 +8160,7 @@
if (platforms.includes('fcm')) {
const fcmPayload = this.fcm.toObject();
if (fcmPayload && Object.keys(fcmPayload).length)
payload.pn_gcm = fcmPayload;
payload.pn_fcm = fcmPayload;
}
if (Object.keys(payload).length && this._debugging)
payload.pn_debug = true;
Expand Down Expand Up @@ -13240,7 +13240,7 @@
(!('channels' in this.parameters) || this.parameters.channels.length === 0))
return 'Missing Channels';
if (!pushGateway)
return 'Missing GW Type (pushGateway: gcm or apns2)';
return 'Missing GW Type (pushGateway: fcm or apns2)';
if (this.parameters.pushGateway === 'apns2' && !this.parameters.topic)
return 'Missing APNS2 topic';
}
Expand Down
2 changes: 1 addition & 1 deletion dist/web/pubnub.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs-snippets/basic-usage/mobile-push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ try {
const response = await pubnub.push.addChannels({
channels: ['a', 'b'],
device: 'niceDevice',
pushGateway: 'gcm',
pushGateway: 'fcm',
});
console.log('device added to channels response:', response);
} catch (error) {
Expand Down Expand Up @@ -68,7 +68,7 @@ try {
try {
const response = await pubnub.push.listChannels({
device: 'niceDevice',
pushGateway: 'gcm',
pushGateway: 'fcm',
});

console.log('listing channels for device response:', response);
Expand Down Expand Up @@ -110,7 +110,7 @@ try {
const response = await pubnub.push.removeChannels({
channels: ['a', 'b'],
device: 'niceDevice',
pushGateway: 'gcm',
pushGateway: 'fcm',
});

console.log('removing device from channel response:', response);
Expand Down Expand Up @@ -147,7 +147,7 @@ try {
try {
const response = await pubnub.push.deleteDevice({
device: 'niceDevice',
pushGateway: 'gcm',
pushGateway: 'fcm',
});

console.log('deleteDevice response:', response);
Expand Down
2 changes: 1 addition & 1 deletion lib/core/components/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
return base.PubNubFile;
},
get version() {
return '10.2.1';
return '10.2.2';
},
getVersion() {
return this.version;
Expand Down
2 changes: 1 addition & 1 deletion lib/core/components/push_payload.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ class NotificationsPayload {
if (platforms.includes('fcm')) {
const fcmPayload = this.fcm.toObject();
if (fcmPayload && Object.keys(fcmPayload).length)
payload.pn_gcm = fcmPayload;
payload.pn_fcm = fcmPayload;
}
if (Object.keys(payload).length && this._debugging)
payload.pn_debug = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/core/endpoints/push/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class BasePushNotificationChannelsRequest extends request_1.AbstractRequest {
(!('channels' in this.parameters) || this.parameters.channels.length === 0))
return 'Missing Channels';
if (!pushGateway)
return 'Missing GW Type (pushGateway: gcm or apns2)';
return 'Missing GW Type (pushGateway: fcm or apns2)';
if (this.parameters.pushGateway === 'apns2' && !this.parameters.topic)
return 'Missing APNS2 topic';
}
Expand Down
6 changes: 3 additions & 3 deletions lib/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4006,7 +4006,7 @@ declare namespace PubNub {
};

/**
* Payload for `pn_gcm` field in published message.
* Payload for `pn_fcm` field in published message.
*/
type FCMPayload = {
/**
Expand Down Expand Up @@ -4400,7 +4400,7 @@ declare namespace PubNub {
*/
buildPayload(platforms: ('apns' | 'apns2' | 'fcm')[]): {
pn_apns?: APNSPayload;
pn_gcm?: FCMPayload;
pn_fcm?: FCMPayload;
pn_debug?: boolean;
};
}
Expand Down Expand Up @@ -8927,7 +8927,7 @@ declare namespace PubNub {
/**
* Push Notifications gateway type.
*/
pushGateway: 'gcm';
pushGateway: 'fcm';
};

/**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pubnub",
"version": "10.2.1",
"version": "10.2.2",
"author": "PubNub <support@pubnub.com>",
"description": "Publish & Subscribe Real-time Messaging with PubNub",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const makeConfiguration = (
return base.PubNubFile;
},
get version(): string {
return '10.2.1';
return '10.2.2';
},
getVersion(): string {
return this.version;
Expand Down
6 changes: 3 additions & 3 deletions src/core/components/push_payload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ type PubNubAPNS2Target = Omit<APNS2Target, 'excludedDevices'> & {

// region FCM
/**
* Payload for `pn_gcm` field in published message.
* Payload for `pn_fcm` field in published message.
*/
type FCMPayload = {
/**
Expand Down Expand Up @@ -975,7 +975,7 @@ class NotificationsPayload {
* specified platforms.
*/
buildPayload(platforms: ('apns' | 'apns2' | 'fcm')[]) {
const payload: { pn_apns?: APNSPayload; pn_gcm?: FCMPayload; pn_debug?: boolean } = {};
const payload: { pn_apns?: APNSPayload; pn_fcm?: FCMPayload; pn_debug?: boolean } = {};

if (platforms.includes('apns') || platforms.includes('apns2')) {
// @ts-expect-error Override APNS version.
Expand All @@ -988,7 +988,7 @@ class NotificationsPayload {
if (platforms.includes('fcm')) {
const fcmPayload = this.fcm.toObject();

if (fcmPayload && Object.keys(fcmPayload).length) payload.pn_gcm = fcmPayload;
if (fcmPayload && Object.keys(fcmPayload).length) payload.pn_fcm = fcmPayload;
}

if (Object.keys(payload).length && this._debugging) payload.pn_debug = true;
Expand Down
2 changes: 1 addition & 1 deletion src/core/endpoints/push/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class BasePushNotificationChannelsRequest<R, S extends object> extends Ab
)
return 'Missing Channels';

if (!pushGateway) return 'Missing GW Type (pushGateway: gcm or apns2)';
if (!pushGateway) return 'Missing GW Type (pushGateway: fcm or apns2)';
if (this.parameters.pushGateway === 'apns2' && !this.parameters.topic) return 'Missing APNS2 topic';
}

Expand Down
6 changes: 3 additions & 3 deletions src/core/types/api/push-notifications.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Type of Push Notifications gateway which should be used with Push Notifications REST API.
*/
type PushGateway = 'apns2' | 'gcm';
type PushGateway = 'apns2' | 'fcm';

/**
* Basic information required by Push Notifications REST API about device.
Expand All @@ -16,8 +16,8 @@ type DevicePush = {
* Push Notifications gateway to use.
*
* **Important:** Depends on from the source of `device` token and can be `apns2` (for token
* provided during device registration using Apple's framework) or `gcm` (when used Firebase
* or similar framework to receive token).
* provided during device registration using Apple's framework) or `fcm` (when used Firebase
* Cloud Messaging or similar framework to receive token).
*/
pushGateway: PushGateway;
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/types/api/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type ManageFCMDeviceChannelsParameters = ManagedDeviceChannels & {
/**
* Push Notifications gateway type.
*/
pushGateway: 'gcm';
pushGateway: 'fcm';
};

/**
Expand Down
2 changes: 1 addition & 1 deletion test/dist/react-native.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ describe('#distribution test (rkt-native)', function () {

expect(payload).to.be.an('object');
expect(payload).to.have.property('pn_apns');
expect(payload).to.have.property('pn_gcm');
expect(payload).to.have.property('pn_fcm');
expect(payload.pn_apns.aps.alert.title).to.equal('Test Title');
expect(payload.pn_apns.aps.alert.body).to.equal('Test Body');
});
Expand Down
16 changes: 8 additions & 8 deletions test/integration/endpoints/push.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ describe('push endpoints', () => {
.query({
add: 'a,b',
pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`,
type: 'gcm',
type: 'fcm',
uuid: 'myUUID',
})
.reply(200, '[1, "Modified Channels"]', { 'content-type': 'text/javascript' });

pubnub.push.addChannels({ channels: ['a', 'b'], device: 'niceDevice', pushGateway: 'gcm' }, (status) => {
pubnub.push.addChannels({ channels: ['a', 'b'], device: 'niceDevice', pushGateway: 'fcm' }, (status) => {
try {
assert.equal(status.error, false);
assert.equal(scope.isDone(), true);
Expand Down Expand Up @@ -165,12 +165,12 @@ describe('push endpoints', () => {
.get('/v1/push/sub-key/mySubKey/devices/coolDevice')
.query({
pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`,
type: 'gcm',
type: 'fcm',
uuid: 'myUUID',
})
.reply(200, '["ch1", "ch2", "ch3"]', { 'content-type': 'text/javascript' });

pubnub.push.listChannels({ device: 'coolDevice', pushGateway: 'gcm' }, (status, response) => {
pubnub.push.listChannels({ device: 'coolDevice', pushGateway: 'fcm' }, (status, response) => {
try {
assert.equal(status.error, false);
assert(response !== null);
Expand Down Expand Up @@ -243,7 +243,7 @@ describe('push endpoints', () => {
.query({
remove: 'a,b',
pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`,
type: 'gcm',
type: 'fcm',
uuid: 'myUUID',
})
.reply(200, '[1, "Modified Channels"]', { 'content-type': 'text/javascript' });
Expand All @@ -252,7 +252,7 @@ describe('push endpoints', () => {
{
channels: ['a', 'b'],
device: 'niceDevice',
pushGateway: 'gcm',
pushGateway: 'fcm',
},
(status) => {
try {
Expand Down Expand Up @@ -323,12 +323,12 @@ describe('push endpoints', () => {
.get('/v1/push/sub-key/mySubKey/devices/niceDevice/remove')
.query({
pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`,
type: 'gcm',
type: 'fcm',
uuid: 'myUUID',
})
.reply(200, '[1, "Modified Channels"]', { 'content-type': 'text/javascript' });

pubnub.push.deleteDevice({ device: 'niceDevice', pushGateway: 'gcm' }, (status) => {
pubnub.push.deleteDevice({ device: 'niceDevice', pushGateway: 'fcm' }, (status) => {
try {
assert.equal(status.error, false);
assert.equal(scope.isDone(), true);
Expand Down
4 changes: 2 additions & 2 deletions test/unit/notifications_payload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('#notifications helper', () => {
pn_apns: {
aps: { alert: { title: expectedTitle, body: expectedBody } },
},
pn_gcm: {
pn_fcm: {
notification: { title: expectedTitle, body: expectedBody },
},
};
Expand All @@ -120,7 +120,7 @@ describe('#notifications helper', () => {
},
],
},
pn_gcm: {
pn_fcm: {
notification: { title: expectedTitle, body: expectedBody },
},
};
Expand Down
Loading
Loading