@ohos-ports/genesys-cloud-streaming-client 20.1.0-beta.1
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 +47 -0
- package/dist/cjs/alerting-leader.d.ts +29 -0
- package/dist/cjs/alerting-leader.js +163 -0
- package/dist/cjs/client.d.ts +84 -0
- package/dist/cjs/client.js +680 -0
- package/dist/cjs/connection-manager.d.ts +18 -0
- package/dist/cjs/connection-manager.js +120 -0
- package/dist/cjs/connection-transfer.d.ts +7 -0
- package/dist/cjs/connection-transfer.js +20 -0
- package/dist/cjs/http-client.d.ts +18 -0
- package/dist/cjs/http-client.js +230 -0
- package/dist/cjs/index.d.ts +10 -0
- package/dist/cjs/index.js +31 -0
- package/dist/cjs/messenger.d.ts +37 -0
- package/dist/cjs/messenger.js +54 -0
- package/dist/cjs/notifications.d.ts +94 -0
- package/dist/cjs/notifications.js +495 -0
- package/dist/cjs/ping.d.ts +21 -0
- package/dist/cjs/ping.js +60 -0
- package/dist/cjs/polyfills.d.ts +0 -0
- package/dist/cjs/polyfills.js +6 -0
- package/dist/cjs/server-monitor.d.ts +16 -0
- package/dist/cjs/server-monitor.js +44 -0
- package/dist/cjs/stanza-definitions/webrtc-signaling.d.ts +29 -0
- package/dist/cjs/stanza-definitions/webrtc-signaling.js +113 -0
- package/dist/cjs/stanza-definitions/xep0051.d.ts +19 -0
- package/dist/cjs/stanza-definitions/xep0051.js +28 -0
- package/dist/cjs/stats-formatter.d.ts +6 -0
- package/dist/cjs/stats-formatter.js +63 -0
- package/dist/cjs/types/genesys-cloud-media-session.d.ts +64 -0
- package/dist/cjs/types/genesys-cloud-media-session.js +353 -0
- package/dist/cjs/types/interfaces.d.ts +310 -0
- package/dist/cjs/types/interfaces.js +22 -0
- package/dist/cjs/types/libs.d.ts +32 -0
- package/dist/cjs/types/libs.js +1 -0
- package/dist/cjs/types/media-session.d.ts +76 -0
- package/dist/cjs/types/media-session.js +2 -0
- package/dist/cjs/types/named-agent.d.ts +13 -0
- package/dist/cjs/types/named-agent.js +2 -0
- package/dist/cjs/types/offline-error.d.ts +2 -0
- package/dist/cjs/types/offline-error.js +5 -0
- package/dist/cjs/types/sasl-error.d.ts +8 -0
- package/dist/cjs/types/sasl-error.js +12 -0
- package/dist/cjs/types/stanza-media-session.d.ts +56 -0
- package/dist/cjs/types/stanza-media-session.js +255 -0
- package/dist/cjs/types/streaming-client-extension.d.ts +14 -0
- package/dist/cjs/types/streaming-client-extension.js +2 -0
- package/dist/cjs/types/timeout-error.d.ts +3 -0
- package/dist/cjs/types/timeout-error.js +9 -0
- package/dist/cjs/types/user-cancelled-error.d.ts +2 -0
- package/dist/cjs/types/user-cancelled-error.js +5 -0
- package/dist/cjs/utils.d.ts +34 -0
- package/dist/cjs/utils.js +202 -0
- package/dist/cjs/webrtc.d.ts +126 -0
- package/dist/cjs/webrtc.js +891 -0
- package/dist/deploy-info.json +21 -0
- package/dist/es/alerting-leader.d.ts +29 -0
- package/dist/es/alerting-leader.js +177 -0
- package/dist/es/client.d.ts +84 -0
- package/dist/es/client.js +699 -0
- package/dist/es/connection-manager.d.ts +18 -0
- package/dist/es/connection-manager.js +124 -0
- package/dist/es/connection-transfer.d.ts +7 -0
- package/dist/es/connection-transfer.js +16 -0
- package/dist/es/http-client.d.ts +18 -0
- package/dist/es/http-client.js +194 -0
- package/dist/es/index.bundle.js +39629 -0
- package/dist/es/index.d.ts +10 -0
- package/dist/es/index.js +10 -0
- package/dist/es/messenger.d.ts +37 -0
- package/dist/es/messenger.js +62 -0
- package/dist/es/notifications.d.ts +94 -0
- package/dist/es/notifications.js +507 -0
- package/dist/es/ping.d.ts +21 -0
- package/dist/es/ping.js +68 -0
- package/dist/es/polyfills.d.ts +0 -0
- package/dist/es/polyfills.js +6 -0
- package/dist/es/server-monitor.d.ts +16 -0
- package/dist/es/server-monitor.js +41 -0
- package/dist/es/stanza-definitions/webrtc-signaling.d.ts +29 -0
- package/dist/es/stanza-definitions/webrtc-signaling.js +110 -0
- package/dist/es/stanza-definitions/xep0051.d.ts +19 -0
- package/dist/es/stanza-definitions/xep0051.js +25 -0
- package/dist/es/stats-formatter.d.ts +6 -0
- package/dist/es/stats-formatter.js +54 -0
- package/dist/es/types/genesys-cloud-media-session.d.ts +64 -0
- package/dist/es/types/genesys-cloud-media-session.js +379 -0
- package/dist/es/types/interfaces.d.ts +310 -0
- package/dist/es/types/interfaces.js +19 -0
- package/dist/es/types/libs.d.ts +32 -0
- package/dist/es/types/libs.js +1 -0
- package/dist/es/types/media-session.d.ts +76 -0
- package/dist/es/types/media-session.js +1 -0
- package/dist/es/types/named-agent.d.ts +13 -0
- package/dist/es/types/named-agent.js +1 -0
- package/dist/es/types/offline-error.d.ts +2 -0
- package/dist/es/types/offline-error.js +2 -0
- package/dist/es/types/sasl-error.d.ts +8 -0
- package/dist/es/types/sasl-error.js +9 -0
- package/dist/es/types/stanza-media-session.d.ts +56 -0
- package/dist/es/types/stanza-media-session.js +264 -0
- package/dist/es/types/streaming-client-extension.d.ts +14 -0
- package/dist/es/types/streaming-client-extension.js +1 -0
- package/dist/es/types/timeout-error.d.ts +3 -0
- package/dist/es/types/timeout-error.js +5 -0
- package/dist/es/types/user-cancelled-error.d.ts +2 -0
- package/dist/es/types/user-cancelled-error.js +2 -0
- package/dist/es/utils.d.ts +34 -0
- package/dist/es/utils.js +192 -0
- package/dist/es/webrtc.d.ts +126 -0
- package/dist/es/webrtc.js +917 -0
- package/dist/manifest.json +19 -0
- package/dist/npm/CHANGELOG.md +637 -0
- package/dist/npm/README.md +47 -0
- package/dist/npm/alerting-leader.d.ts +29 -0
- package/dist/npm/alerting-leader.js +163 -0
- package/dist/npm/client.d.ts +84 -0
- package/dist/npm/client.js +680 -0
- package/dist/npm/connection-manager.d.ts +18 -0
- package/dist/npm/connection-manager.js +120 -0
- package/dist/npm/connection-transfer.d.ts +7 -0
- package/dist/npm/connection-transfer.js +20 -0
- package/dist/npm/http-client.d.ts +18 -0
- package/dist/npm/http-client.js +230 -0
- package/dist/npm/index.d.ts +10 -0
- package/dist/npm/index.js +31 -0
- package/dist/npm/messenger.d.ts +37 -0
- package/dist/npm/messenger.js +54 -0
- package/dist/npm/module.js +10 -0
- package/dist/npm/notifications.d.ts +94 -0
- package/dist/npm/notifications.js +495 -0
- package/dist/npm/ping.d.ts +21 -0
- package/dist/npm/ping.js +60 -0
- package/dist/npm/polyfills.d.ts +0 -0
- package/dist/npm/polyfills.js +6 -0
- package/dist/npm/server-monitor.d.ts +16 -0
- package/dist/npm/server-monitor.js +44 -0
- package/dist/npm/stanza-definitions/webrtc-signaling.d.ts +29 -0
- package/dist/npm/stanza-definitions/webrtc-signaling.js +113 -0
- package/dist/npm/stanza-definitions/xep0051.d.ts +19 -0
- package/dist/npm/stanza-definitions/xep0051.js +28 -0
- package/dist/npm/stats-formatter.d.ts +6 -0
- package/dist/npm/stats-formatter.js +63 -0
- package/dist/npm/types/genesys-cloud-media-session.d.ts +64 -0
- package/dist/npm/types/genesys-cloud-media-session.js +353 -0
- package/dist/npm/types/interfaces.d.ts +310 -0
- package/dist/npm/types/interfaces.js +22 -0
- package/dist/npm/types/libs.d.ts +32 -0
- package/dist/npm/types/libs.js +1 -0
- package/dist/npm/types/media-session.d.ts +76 -0
- package/dist/npm/types/media-session.js +2 -0
- package/dist/npm/types/named-agent.d.ts +13 -0
- package/dist/npm/types/named-agent.js +2 -0
- package/dist/npm/types/offline-error.d.ts +2 -0
- package/dist/npm/types/offline-error.js +5 -0
- package/dist/npm/types/sasl-error.d.ts +8 -0
- package/dist/npm/types/sasl-error.js +12 -0
- package/dist/npm/types/stanza-media-session.d.ts +56 -0
- package/dist/npm/types/stanza-media-session.js +255 -0
- package/dist/npm/types/streaming-client-extension.d.ts +14 -0
- package/dist/npm/types/streaming-client-extension.js +2 -0
- package/dist/npm/types/timeout-error.d.ts +3 -0
- package/dist/npm/types/timeout-error.js +9 -0
- package/dist/npm/types/user-cancelled-error.d.ts +2 -0
- package/dist/npm/types/user-cancelled-error.js +5 -0
- package/dist/npm/utils.d.ts +34 -0
- package/dist/npm/utils.js +207 -0
- package/dist/npm/webrtc.d.ts +126 -0
- package/dist/npm/webrtc.js +893 -0
- package/dist/streaming-client.browser.js +2 -0
- package/dist/streaming-client.browser.js.LICENSE.txt +12 -0
- package/dist/v20/streaming-client.browser.js +2 -0
- package/dist/v20/streaming-client.browser.js.LICENSE.txt +12 -0
- package/dist/v20.1.0/streaming-client.browser.js +2 -0
- package/dist/v20.1.0/streaming-client.browser.js.LICENSE.txt +12 -0
- package/package.json +132 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "20.1.0",
|
|
3
|
+
"build": "19",
|
|
4
|
+
"buildDate": "2026-09-11T05:12:04.713Z",
|
|
5
|
+
"indexFiles": [
|
|
6
|
+
{
|
|
7
|
+
"file": "v20.1.0/streaming-client.browser.js"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"file": "v20.1.0/streaming-client.browser.js.LICENSE.txt"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"file": "v20/streaming-client.browser.js"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"file": "v20/streaming-client.browser.js.LICENSE.txt"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"team": "Client Streaming and Signaling",
|
|
20
|
+
"gcServiceName": "developercenter-cdn--streaming-client-webui"
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IClientOptions, ILeaderStatus, StreamingClientExtension } from './types/interfaces';
|
|
3
|
+
import { Client } from './client';
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
import { NamedAgent } from './types/named-agent';
|
|
6
|
+
export declare class AlertingLeaderExtension extends EventEmitter implements StreamingClientExtension {
|
|
7
|
+
private client;
|
|
8
|
+
private connectionId?;
|
|
9
|
+
private alertableInteractionTypes;
|
|
10
|
+
private getLeaderAbortController?;
|
|
11
|
+
private leaderStatus;
|
|
12
|
+
private debouncedClaimAlertingLeader;
|
|
13
|
+
constructor(client: Client, options: IClientOptions);
|
|
14
|
+
handleStanzaInstanceChange(stanzaInstance: NamedAgent): void;
|
|
15
|
+
private setupAlertingLeader;
|
|
16
|
+
private subscribeToAlertingLeader;
|
|
17
|
+
private markAsAlertable;
|
|
18
|
+
private getAlertingLeaderEarly;
|
|
19
|
+
private getAlertingLeader;
|
|
20
|
+
private claimAlertingLeader;
|
|
21
|
+
get expose(): AlertingLeaderApi;
|
|
22
|
+
}
|
|
23
|
+
export interface AlertingLeaderApi {
|
|
24
|
+
on: (event: string, handler: (...args: any) => void) => void;
|
|
25
|
+
off: (event: string, handler: (...args: any) => void) => void;
|
|
26
|
+
claimAlertingLeader(): Promise<void>;
|
|
27
|
+
getLeaderStatus(): ILeaderStatus;
|
|
28
|
+
leaderStatus: ILeaderStatus;
|
|
29
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import debounce from 'debounce-promise';
|
|
12
|
+
import { StreamingClientErrorTypes } from './types/interfaces';
|
|
13
|
+
import { EventEmitter } from 'events';
|
|
14
|
+
import { StreamingClientError, retryPromise } from './utils';
|
|
15
|
+
export class AlertingLeaderExtension extends EventEmitter {
|
|
16
|
+
constructor(client, options) {
|
|
17
|
+
var _a;
|
|
18
|
+
super();
|
|
19
|
+
this.client = client;
|
|
20
|
+
this.leaderStatus = {};
|
|
21
|
+
this.alertableInteractionTypes = (_a = options.alertableInteractionTypes) !== null && _a !== void 0 ? _a : [];
|
|
22
|
+
this.debouncedClaimAlertingLeader = debounce(this.claimAlertingLeader.bind(this), 300);
|
|
23
|
+
}
|
|
24
|
+
handleStanzaInstanceChange(stanzaInstance) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
this.connectionId = (_b = (_a = stanzaInstance.transport) === null || _a === void 0 ? void 0 : _a.stream) === null || _b === void 0 ? void 0 : _b.id;
|
|
27
|
+
this.setupAlertingLeader();
|
|
28
|
+
}
|
|
29
|
+
setupAlertingLeader() {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
if (this.alertableInteractionTypes.length !== 0) {
|
|
32
|
+
try {
|
|
33
|
+
this.getAlertingLeaderEarly();
|
|
34
|
+
yield this.subscribeToAlertingLeader();
|
|
35
|
+
yield this.markAsAlertable();
|
|
36
|
+
yield this.getAlertingLeader();
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
this.client.logger.warn('Failed to setup alerting leader; falling back to acting as the leader');
|
|
40
|
+
// Fail 'open' so users don't miss calls
|
|
41
|
+
this.leaderStatus = { voice: { alerting: true, configured: false } };
|
|
42
|
+
this.emit('alertingLeaderChanged', this.leaderStatus);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
subscribeToAlertingLeader() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const topic = `v2.users.${this.client.config.userId}.alertingleader`;
|
|
50
|
+
this.client.on(`notify:${topic}`, (event) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
(_a = this.getLeaderAbortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
53
|
+
if ((_b = event.eventBody) === null || _b === void 0 ? void 0 : _b.connectionId) {
|
|
54
|
+
// The consuming client should be the one alerting if our connection is the current leader
|
|
55
|
+
const alerting = event.eventBody.connectionId === this.connectionId;
|
|
56
|
+
const clientType = event.eventBody.clientType;
|
|
57
|
+
let voice = { alerting, configured: true };
|
|
58
|
+
if (clientType) {
|
|
59
|
+
voice = Object.assign(Object.assign({}, voice), { clientType });
|
|
60
|
+
}
|
|
61
|
+
this.leaderStatus = { voice };
|
|
62
|
+
this.emit('alertingLeaderChanged', this.leaderStatus);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return this.client._notifications._subscribeInternal(topic);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
markAsAlertable() {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const userId = this.client.config.userId;
|
|
71
|
+
const connectionsRequestOptions = {
|
|
72
|
+
method: 'patch',
|
|
73
|
+
host: this.client.config.apiHost,
|
|
74
|
+
authToken: this.client.config.authToken,
|
|
75
|
+
logger: this.client.logger,
|
|
76
|
+
data: {
|
|
77
|
+
alertable: true
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// STREAM-1204
|
|
81
|
+
// There's a race condition between the backend service knowing about the connection
|
|
82
|
+
// and us marking the connection as alertable. For now, we'll just retry with some delay.
|
|
83
|
+
const maxRetries = 16;
|
|
84
|
+
let retryCount = 0;
|
|
85
|
+
const retry = retryPromise(() => this.client.http.requestApi(`apps/users/${userId}/connections/${this.connectionId}`, connectionsRequestOptions), () => {
|
|
86
|
+
retryCount++;
|
|
87
|
+
if (retryCount >= maxRetries) {
|
|
88
|
+
this.client.logger.info('Max retries reached for marking connection as alertable');
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}, 500, this.client.logger);
|
|
93
|
+
return retry.promise
|
|
94
|
+
.catch(() => {
|
|
95
|
+
this.client.logger.warn('Could not mark this connection as alertable');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
getAlertingLeaderEarly() {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
try {
|
|
102
|
+
yield this.getAlertingLeader();
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
if (axios.isAxiosError(error) && error.status === 400) {
|
|
106
|
+
this.client.logger.info('The org has not configured alerting leader functionality or there are not yet any active alertable connections; falling back to acting as the leader');
|
|
107
|
+
this.leaderStatus = { voice: { alerting: true, configured: false } };
|
|
108
|
+
this.emit('alertingLeaderChanged', this.leaderStatus);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
getAlertingLeader() {
|
|
114
|
+
var _a;
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
// If an early request is still in-flight, cancel it and get more recent data
|
|
117
|
+
(_a = this.getLeaderAbortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
118
|
+
this.getLeaderAbortController = new AbortController();
|
|
119
|
+
const leaderRequestOptions = {
|
|
120
|
+
method: 'get',
|
|
121
|
+
host: this.client.config.apiHost,
|
|
122
|
+
authToken: this.client.config.authToken,
|
|
123
|
+
logger: this.client.logger,
|
|
124
|
+
signal: this.getLeaderAbortController.signal
|
|
125
|
+
};
|
|
126
|
+
try {
|
|
127
|
+
const currentLeader = yield this.client.http.requestApiWithRetry('users/alertingleader', leaderRequestOptions, 1000).promise;
|
|
128
|
+
// The consuming client should be the one alerting if our connection is the current leader
|
|
129
|
+
const alerting = currentLeader.data.connectionId === this.connectionId;
|
|
130
|
+
const clientType = currentLeader.data.clientType;
|
|
131
|
+
let voice = { alerting, configured: true };
|
|
132
|
+
if (clientType) {
|
|
133
|
+
voice = Object.assign(Object.assign({}, voice), { clientType });
|
|
134
|
+
}
|
|
135
|
+
this.leaderStatus = { voice };
|
|
136
|
+
this.emit('alertingLeaderChanged', this.leaderStatus);
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
if (axios.isCancel(err)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
throw err;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
claimAlertingLeader() {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
if (this.alertableInteractionTypes.length === 0) {
|
|
149
|
+
this.client.logger.info('This client is not configured for any alertable interactions and will not attempt to claim alerting leader');
|
|
150
|
+
throw new StreamingClientError(StreamingClientErrorTypes.generic, 'Unable to claim alerting leader; this client is not configured for any alertable interactions');
|
|
151
|
+
}
|
|
152
|
+
const leaderRequestOptions = {
|
|
153
|
+
method: 'put',
|
|
154
|
+
host: this.client.config.apiHost,
|
|
155
|
+
authToken: this.client.config.authToken,
|
|
156
|
+
logger: this.client.logger,
|
|
157
|
+
data: {
|
|
158
|
+
connectionId: this.connectionId
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
return this.client.http.requestApi('users/alertingleader', leaderRequestOptions)
|
|
162
|
+
.catch((err) => {
|
|
163
|
+
this.client.logger.warn('Unable to claim alerting leader; this client may not alert for incoming interactions');
|
|
164
|
+
throw new StreamingClientError(StreamingClientErrorTypes.generic, 'Unable to claim alerting leader', err);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
get expose() {
|
|
169
|
+
return {
|
|
170
|
+
on: this.on.bind(this),
|
|
171
|
+
off: this.off.bind(this),
|
|
172
|
+
claimAlertingLeader: this.debouncedClaimAlertingLeader,
|
|
173
|
+
getLeaderStatus: () => { return this.leaderStatus; },
|
|
174
|
+
leaderStatus: this.leaderStatus
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Logger } from 'genesys-cloud-client-logger';
|
|
3
|
+
import './polyfills';
|
|
4
|
+
import { AlertingLeaderExtension, AlertingLeaderApi } from './alerting-leader';
|
|
5
|
+
import { Notifications, NotificationsAPI } from './notifications';
|
|
6
|
+
import { WebrtcExtension, WebrtcExtensionAPI } from './webrtc';
|
|
7
|
+
import { Ping } from './ping';
|
|
8
|
+
import { StreamingClientExtension } from './types/streaming-client-extension';
|
|
9
|
+
import { HttpClient } from './http-client';
|
|
10
|
+
import { IClientOptions, IClientConfig, StreamingClientConnectOptions } from './types/interfaces';
|
|
11
|
+
import { NamedAgent } from './types/named-agent';
|
|
12
|
+
import EventEmitter from 'events';
|
|
13
|
+
import { MessengerExtensionApi, MessengerExtension } from './messenger';
|
|
14
|
+
export declare class Client extends EventEmitter {
|
|
15
|
+
activeStanzaInstance?: NamedAgent;
|
|
16
|
+
connected: boolean;
|
|
17
|
+
connecting: boolean;
|
|
18
|
+
hardReconnectRequired: boolean;
|
|
19
|
+
reconnectOnNoLongerSubscribed: boolean;
|
|
20
|
+
useServerSidePings: boolean;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
config: IClientConfig;
|
|
23
|
+
isGuest: boolean;
|
|
24
|
+
backgroundAssistantMode: boolean;
|
|
25
|
+
private autoReconnect;
|
|
26
|
+
private cancelConnectionAttempt;
|
|
27
|
+
private extensions;
|
|
28
|
+
private connectionManager;
|
|
29
|
+
private channelReuses;
|
|
30
|
+
private backoffReductionTimer;
|
|
31
|
+
private hasMadeInitialAttempt;
|
|
32
|
+
private jidResource;
|
|
33
|
+
private boundStanzaDisconnect?;
|
|
34
|
+
private boundStanzaNoLongerSubscribed?;
|
|
35
|
+
private boundStanzaDuplicateId?;
|
|
36
|
+
http: HttpClient;
|
|
37
|
+
notifications: NotificationsAPI;
|
|
38
|
+
_notifications: Notifications;
|
|
39
|
+
webrtcSessions: WebrtcExtensionAPI;
|
|
40
|
+
_webrtcSessions: WebrtcExtension;
|
|
41
|
+
messenger: MessengerExtension;
|
|
42
|
+
_messenger: MessengerExtensionApi;
|
|
43
|
+
alertingLeader: AlertingLeaderApi;
|
|
44
|
+
_alertingLeader: AlertingLeaderExtension;
|
|
45
|
+
_ping: Ping;
|
|
46
|
+
constructor(options: IClientOptions);
|
|
47
|
+
private handleSendEventFromExtension;
|
|
48
|
+
private checkIsBackgroundAssistant;
|
|
49
|
+
private addInateEventHandlers;
|
|
50
|
+
private removeStanzaBoundEventHandlers;
|
|
51
|
+
private proxyStanzaEvents;
|
|
52
|
+
private handleStanzaDisconnectedEvent;
|
|
53
|
+
private handleNoLongerSubscribed;
|
|
54
|
+
private handleDuplicateId;
|
|
55
|
+
disconnect(): Promise<any>;
|
|
56
|
+
private getSessionStoreKey;
|
|
57
|
+
private getConnectionData;
|
|
58
|
+
private setConnectionData;
|
|
59
|
+
private increaseBackoff;
|
|
60
|
+
private decreaseBackoff;
|
|
61
|
+
private getStartingDelay;
|
|
62
|
+
connect(connectOpts?: StreamingClientConnectOptions): Promise<void>;
|
|
63
|
+
private backoffConnectRetryHandler;
|
|
64
|
+
private networkErrorNeedsAuth;
|
|
65
|
+
private saslErrorIsRetryable;
|
|
66
|
+
/**
|
|
67
|
+
* Performs an active network connectivity check by querying the API.
|
|
68
|
+
* navigator.onLine is unreliable (VPNs, virtual adapters, etc.), so we
|
|
69
|
+
* actually reach out to verify we can talk to the server.
|
|
70
|
+
*
|
|
71
|
+
* Returns true if connectivity is confirmed, false otherwise.
|
|
72
|
+
* This is advisory only — it does not gate connection attempts.
|
|
73
|
+
*/
|
|
74
|
+
checkNetworkConnectivity(): Promise<boolean>;
|
|
75
|
+
private makeConnectionAttempt;
|
|
76
|
+
private setupConnectionMonitoring;
|
|
77
|
+
private prepareForConnect;
|
|
78
|
+
stopServerLogging(): void;
|
|
79
|
+
startServerLogging(): void;
|
|
80
|
+
setAccessToken(token: string): void;
|
|
81
|
+
static extend(namespace: any, extension: StreamingClientExtension | ((client: Client) => void)): void;
|
|
82
|
+
get version(): string;
|
|
83
|
+
static get version(): string;
|
|
84
|
+
}
|