Skip to content

Commit e8b2256

Browse files
authored
Fix issue with string signals (#388)
fix(listener): fix issue with string signals Fix issue because of which signals sent as string not handler properly.
1 parent 5dc7ec7 commit e8b2256

File tree

15 files changed

+222
-139
lines changed

15 files changed

+222
-139
lines changed

.pubnub.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
---
22
changelog:
3+
- date: 2024-07-04
4+
version: v8.2.5
5+
changes:
6+
- type: bug
7+
text: "Fix issue because of which `signals` sent as `string` not handler properly."
38
- date: 2024-06-17
49
version: v8.2.4
510
changes:
@@ -1008,7 +1013,7 @@ supported-platforms:
10081013
- 'Ubuntu 14.04 and up'
10091014
- 'Windows 7 and up'
10101015
version: 'Pubnub Javascript for Node'
1011-
version: '8.2.4'
1016+
version: '8.2.5'
10121017
sdks:
10131018
- full-name: PubNub Javascript SDK
10141019
short-name: Javascript
@@ -1024,7 +1029,7 @@ sdks:
10241029
- distribution-type: source
10251030
distribution-repository: GitHub release
10261031
package-name: pubnub.js
1027-
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.4.zip
1032+
location: https://github.com/pubnub/javascript/archive/refs/tags/v8.2.5.zip
10281033
requires:
10291034
- name: 'agentkeepalive'
10301035
min-version: '3.5.2'
@@ -1695,7 +1700,7 @@ sdks:
16951700
- distribution-type: library
16961701
distribution-repository: GitHub release
16971702
package-name: pubnub.js
1698-
location: https://github.com/pubnub/javascript/releases/download/v8.2.4/pubnub.8.2.4.js
1703+
location: https://github.com/pubnub/javascript/releases/download/v8.2.5/pubnub.8.2.5.js
16991704
requires:
17001705
- name: 'agentkeepalive'
17011706
min-version: '3.5.2'

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## v8.2.5
2+
July 04 2024
3+
4+
#### Fixed
5+
- Fix issue because of which `signals` sent as `string` not handler properly. Fixed the following issues reported by [@roman-rr](https://github.com/roman-rr): [#387](https://github.com/pubnub/javascript/issues/387).
6+
17
## v8.2.4
28
June 17 2024
39

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Watch [Getting Started with PubNub JS SDK](https://app.dashcam.io/replay/64ee0d2
2828
npm install pubnub
2929
```
3030
* or download one of our builds from our CDN:
31-
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.4.js
32-
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.4.min.js
31+
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.5.js
32+
* https://cdn.pubnub.com/sdk/javascript/pubnub.8.2.5.min.js
3333
3434
2. Configure your keys:
3535

dist/web/pubnub.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3813,7 +3813,7 @@
38133813
return base.PubNubFile;
38143814
},
38153815
get version() {
3816-
return '8.2.4';
3816+
return '8.2.5';
38173817
},
38183818
getVersion() {
38193819
return this.version;
@@ -5870,7 +5870,7 @@
58705870
// Resolve missing event type.
58715871
eventType !== null && eventType !== void 0 ? eventType : (eventType = envelope.c.endsWith('-pnpres') ? PubNubEventType.Presence : PubNubEventType.Message);
58725872
// Check whether payload is string (potentially encrypted data).
5873-
if (typeof envelope.d === 'string') {
5873+
if (eventType != PubNubEventType.Signal && typeof envelope.d === 'string') {
58745874
if (eventType == PubNubEventType.Message) {
58755875
return {
58765876
type: PubNubEventType.Message,

dist/web/pubnub.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/core/components/configuration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const makeConfiguration = (base, setupCryptoModule) => {
110110
return base.PubNubFile;
111111
},
112112
get version() {
113-
return '8.2.4';
113+
return '8.2.5';
114114
},
115115
getVersion() {
116116
return this.version;

lib/core/endpoints/subscribe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class BaseSubscribeRequest extends request_1.AbstractRequest {
117117
// Resolve missing event type.
118118
eventType !== null && eventType !== void 0 ? eventType : (eventType = envelope.c.endsWith('-pnpres') ? PubNubEventType.Presence : PubNubEventType.Message);
119119
// Check whether payload is string (potentially encrypted data).
120-
if (typeof envelope.d === 'string') {
120+
if (eventType != PubNubEventType.Signal && typeof envelope.d === 'string') {
121121
if (eventType == PubNubEventType.Message) {
122122
return {
123123
type: PubNubEventType.Message,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pubnub",
3-
"version": "8.2.4",
3+
"version": "8.2.5",
44
"author": "PubNub <[email protected]>",
55
"description": "Publish & Subscribe Real-time Messaging with PubNub",
66
"scripts": {

src/core/components/configuration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const makeConfiguration = (
169169
return base.PubNubFile;
170170
},
171171
get version(): string {
172-
return '8.2.4';
172+
return '8.2.5';
173173
},
174174
getVersion(): string {
175175
return this.version;

src/core/endpoints/subscribe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ export class BaseSubscribeRequest extends AbstractRequest<Subscription.Subscript
636636
eventType ??= envelope.c.endsWith('-pnpres') ? PubNubEventType.Presence : PubNubEventType.Message;
637637

638638
// Check whether payload is string (potentially encrypted data).
639-
if (typeof envelope.d === 'string') {
639+
if (eventType != PubNubEventType.Signal && typeof envelope.d === 'string') {
640640
if (eventType == PubNubEventType.Message) {
641641
return {
642642
type: PubNubEventType.Message,

test/integration/components/reconnection_manager.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ describe('#components/reconnection_manger', () => {
5656
pubnub.addListener({
5757
status(statusPayload) {
5858
if (statusPayload.operation !== PubNub.OPERATIONS.PNSubscribeOperation) return;
59-
let statusWithoutError = _.omit(statusPayload, ['errorData', 'statusCode']);
59+
const statusWithoutError = _.omit(statusPayload, ['errorData', 'statusCode']);
6060
try {
6161
assert.deepEqual(
6262
{
6363
category: PubNub.CATEGORIES.PNNetworkIssuesCategory,
6464
error: true,
65-
operation: PubNub.OPERATIONS.PNSubscribeOperation
65+
operation: PubNub.OPERATIONS.PNSubscribeOperation,
6666
},
67-
statusWithoutError
67+
statusWithoutError,
6868
);
6969

7070
utils
7171
.createNock()
72-
.get("/v2/presence/sub-key/mySubKey/channel/ch1,ch2/leave")
72+
.get('/v2/presence/sub-key/mySubKey/channel/ch1,ch2/leave')
7373
.query(true)
74-
.reply(200, "{\"status\": 200, \"message\": \"OK\", \"service\": \"Presence\"}", {
75-
"content-type": "text/javascript"
74+
.reply(200, '{"status": 200, "message": "OK", "service": "Presence"}', {
75+
'content-type': 'text/javascript',
7676
});
7777

7878
done();
@@ -113,7 +113,7 @@ describe('#components/reconnection_manger', () => {
113113
.query(true)
114114
.reply(
115115
200,
116-
'{"t":{"t":"14607577960932487","r":1},"m":[{"a":"4","f":0,"i":"Client-g5d4g","p":{"t":"14607577960925503","r":1},"k":"sub-c-4cec9f8e-01fa-11e6-8180-0619f8945a4f","c":"coolChannel","d":{"text":"Enter Message Here"},"b":"coolChan-bnel"}]}',
116+
'{"t":{"t":"14607577960932487","r":1},"m":[{"a":"4","f":0,"i":"Client-g5d4g","p":{"t":"14607577960925503","r":1},"k":"mySubKey","c":"coolChannel","d":{"text":"Enter Message Here"},"b":"coolChan-bnel"}]}',
117117
{ 'content-type': 'text/javascript' },
118118
);
119119

@@ -134,17 +134,17 @@ describe('#components/reconnection_manger', () => {
134134
category: PubNub.CATEGORIES.PNReconnectedCategory,
135135
operation: PubNub.OPERATIONS.PNSubscribeOperation,
136136
currentTimetoken: 0,
137-
lastTimetoken: 0
137+
lastTimetoken: 0,
138138
},
139-
statusPayload
139+
statusPayload,
140140
);
141141

142142
utils
143143
.createNock()
144-
.get("/v2/presence/sub-key/mySubKey/channel/ch1,ch2/leave")
144+
.get('/v2/presence/sub-key/mySubKey/channel/ch1,ch2/leave')
145145
.query(true)
146-
.reply(200, "{\"status\": 200, \"message\": \"OK\", \"service\": \"Presence\"}", {
147-
"content-type": "text/javascript"
146+
.reply(200, '{"status": 200, "message": "OK", "service": "Presence"}', {
147+
'content-type': 'text/javascript',
148148
});
149149

150150
done();

0 commit comments

Comments
 (0)