Skip to content

Commit d9f421a

Browse files
authored
Merge pull request #344 from purecloudlabs/release/v19.6.0
Release/v19.6.0
2 parents 259f4ec + 00925ce commit d9f421a

14 files changed

Lines changed: 760 additions & 56 deletions

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.5.0...HEAD)
7+
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.6.0...HEAD)
8+
9+
# [v19.6.0](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.6.0...HEAD)
10+
### Added
11+
* [STREAM-949](https://inindca.atlassian.net/browse/STREAM-949) - Catch errors and emit them as a `disconnected` event and include error.
12+
* [STREAM-1201](https://inindca.atlassian.net/browse/STREAM-1201) - Add ability to track internally-used subscriptions.
13+
* [STREAM-1179](https://inindca.atlassian.net/browse/STREAM-1179) - Add a config option to allow a streaming-client instance to be marked as alertable (internal-use only).
14+
15+
### Changed
16+
* [STREAM-1208](https://inindca.atlassian.net/browse/STREAM-1208) - Update axios to 1.13.5 to address vulnerability.
17+
* [STREAM-838](https://inindca.atlassian.net/browse/STREAM-838) - Add API based connectivity check for Auth Token clients
18+
* [STREAM-1422](https://inindca.atlassian.net/browse/STREAM-1422) - Update axios to 1.15.0 to address vulnerability.
19+
20+
### Fixed
21+
* [STREAM-1271](https://inindca.atlassian.net/browse/STREAM-1271) - Fix unhandled errors during hard reconnect resubscribe in `handleStanzaInstanceChange`
822

923
# [v19.5.0](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.4.1...v19.5.0)
1024
### Added

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Genesys Cloud Services, Inc.
3+
Copyright (c) 2026 Genesys Cloud Services, Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

doc/documentation.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,23 @@ connectivity with Genesys Cloud. `connect` must be called before any events will
7373
`client.disconnect() : Promise<void>` - Disconnect from the streaming
7474
service
7575

76+
`client.checkNetworkConnectivity() : Promise<boolean>` - Performs an active network
77+
connectivity check. First checks `navigator.onLine` as a quick hint, then makes a
78+
request to the API to verify real connectivity. Returns `true` if connectivity is
79+
confirmed, `false` otherwise. Emits `networkConnectivityWarning` on failure. This is
80+
called automatically during connection attempts but can also be called directly.
81+
In JWT-only mode (no auth token), the active API check is skipped and only
82+
`navigator.onLine` is used.
83+
7684
`client.on(eventName, handler) : void` - register an event handler for the client
7785

7886
- parameters
7987
- `String eventName` - event name to watch
8088
- Events Supported:
8189
- 'connected' - when the streaming service is connected AND authenticated
8290
- 'disconnected' - when the streaming service is disconnected
91+
- 'networkConnectivityWarning' - emitted when a network connectivity issue is detected
92+
before a connection attempt.
8393
- `Function handler` - handler to evoke when event is emitted
8494

8595
`client.once(eventName, handler) : void` - like `on` but handler will be called only once

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
// loadScript('test/scripts/happy-path.js');
3030
// loadScript('test/scripts/duplicate-channel-connection.js');
3131
// loadScript('test/scripts/send-message.js');
32+
// loadScript('test/scripts/token-becoming-invalid.js');
3233
// loadScript('test/scripts/401.js');
3334
// loadScript('test/scripts/custom-logger.js');
3435
// loadScript('test/scripts/connect-with-retry.js');
@@ -39,4 +40,4 @@
3940

4041
</body>
4142

42-
</html>
43+
</html>

package-lock.json

Lines changed: 25 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "genesys-cloud-streaming-client",
3-
"version": "19.5.0",
3+
"version": "19.6.0",
44
"description": "client for the Genesys Cloud Streaming APIs (websocket/xmpp interface)",
55
"repository": "https:github.com/purecloudlabs/genesys-cloud-streaming-client",
66
"license": "MIT",
@@ -50,7 +50,7 @@
5050
"author": "",
5151
"dependencies": {
5252
"@babel/runtime-corejs3": "^7.10.4",
53-
"axios": "^1.12.0",
53+
"axios": "^1.15.0",
5454
"backoff-web": "^1.0.1",
5555
"browserama": "^3.2.0",
5656
"core-js": "^3.6.5",
@@ -82,9 +82,9 @@
8282
"@babel/runtime": "^7.12.0",
8383
"@rollup/plugin-commonjs": "^22.0.0-1",
8484
"@rollup/plugin-node-resolve": "^13.0.6",
85+
"@types/debounce-promise": "^3.1.9",
8586
"@types/eslint": "^8.56.12",
8687
"@types/estree": "^1.0.8",
87-
"@types/debounce-promise": "^3.1.9",
8888
"@types/jest": "^26.0.3",
8989
"@types/lodash.throttle": "^4.1.6",
9090
"@types/nock": "^11.1.0",

src/alerting-leader.ts

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { AlertableInteractionTypes, IClientOptions, RequestApiOptions, StreamingClientExtension } from './types/interfaces';
2+
import { Client } from './client';
3+
import { NamedAgent } from './types/named-agent';
4+
import { retryPromise } from './utils';
5+
6+
export class AlertingLeaderExtension implements StreamingClientExtension {
7+
private connectionId?: string;
8+
private alertableInteractionTypes: AlertableInteractionTypes[];
9+
10+
constructor (private client: Client, options: IClientOptions) {
11+
this.alertableInteractionTypes = options.alertableInteractionTypes ?? [];
12+
}
13+
14+
handleStanzaInstanceChange (stanzaInstance: NamedAgent) {
15+
this.connectionId = stanzaInstance.transport?.stream?.id;
16+
17+
if (this.alertableInteractionTypes.length !== 0) {
18+
this.markAsAlertable();
19+
}
20+
}
21+
22+
private async markAsAlertable (): Promise<any> {
23+
const userId = this.client.config.userId;
24+
const connectionsRequestOptions: RequestApiOptions = {
25+
method: 'patch',
26+
host: this.client.config.apiHost,
27+
authToken: this.client.config.authToken,
28+
logger: this.client.logger,
29+
data: {
30+
alertable: true
31+
}
32+
};
33+
34+
// STREAM-1204
35+
// There's a race condition between the backend service knowing about the connection
36+
// and us marking the connection as alertable. For now, we'll just retry with some delay.
37+
const maxRetries = 16;
38+
let retryCount = 0;
39+
const retry = retryPromise(
40+
() => this.client.http.requestApi(`apps/users/${userId}/connections/${this.connectionId}`, connectionsRequestOptions),
41+
() => {
42+
retryCount++;
43+
if (retryCount >= maxRetries) {
44+
this.client.logger.info('Max retries reached for marking connection as alertable');
45+
return false;
46+
}
47+
return true;
48+
},
49+
500,
50+
this.client.logger
51+
);
52+
53+
return retry.promise
54+
.catch(() => {
55+
this.client.logger.warn('Could not mark this connection as alertable; this client may not alert for incoming interactions');
56+
});
57+
}
58+
59+
get expose (): AlertingLeaderApi {
60+
return {
61+
};
62+
}
63+
}
64+
65+
export interface AlertingLeaderApi {
66+
}

0 commit comments

Comments
 (0)