|
@@ -178,15 +178,6 @@ export default class XMPP extends Listenable {
|
178
|
178
|
}
|
179
|
179
|
}
|
180
|
180
|
|
181
|
|
- /**
|
182
|
|
- * Returns {@code true} if the PING functionality is supported by the server
|
183
|
|
- * or {@code false} otherwise.
|
184
|
|
- * @returns {boolean}
|
185
|
|
- */
|
186
|
|
- isPingSupported() {
|
187
|
|
- return this._pingSupported !== false;
|
188
|
|
- }
|
189
|
|
-
|
190
|
181
|
/**
|
191
|
182
|
*
|
192
|
183
|
*/
|
|
@@ -233,13 +224,15 @@ export default class XMPP extends Listenable {
|
233
|
224
|
// FIXME no need to do it again on stream resume
|
234
|
225
|
this.caps.getFeaturesAndIdentities(pingJid)
|
235
|
226
|
.then(({ features, identities }) => {
|
236
|
|
- if (features.has(Strophe.NS.PING)) {
|
237
|
|
- this._pingSupported = true;
|
238
|
|
- this.connection.ping.startInterval(pingJid);
|
239
|
|
- } else {
|
240
|
|
- logger.warn(`Ping NOT supported by ${pingJid}`);
|
|
227
|
+ if (!features.has(Strophe.NS.PING)) {
|
|
228
|
+ logger.error(
|
|
229
|
+ `Ping NOT supported by ${pingJid} - please enable ping in your XMPP server config`);
|
241
|
230
|
}
|
242
|
231
|
|
|
232
|
+ // It counterintuitive to start ping task when it's not supported, but since PING is now mandatory
|
|
233
|
+ // it's done on purpose in order to print error logs and bring more attention.
|
|
234
|
+ this.connection.ping.startInterval(pingJid);
|
|
235
|
+
|
243
|
236
|
// check for speakerstats
|
244
|
237
|
identities.forEach(identity => {
|
245
|
238
|
if (identity.type === 'speakerstats') {
|
|
@@ -533,20 +526,15 @@ export default class XMPP extends Listenable {
|
533
|
526
|
}
|
534
|
527
|
|
535
|
528
|
/**
|
536
|
|
- * Pings the server. Remember to check {@link isPingSupported} before using
|
537
|
|
- * this method.
|
|
529
|
+ * Pings the server.
|
538
|
530
|
* @param timeout how many ms before a timeout should occur.
|
539
|
531
|
* @returns {Promise} resolved on ping success and reject on an error or
|
540
|
532
|
* a timeout.
|
541
|
533
|
*/
|
542
|
534
|
ping(timeout) {
|
543
|
535
|
return new Promise((resolve, reject) => {
|
544
|
|
- if (this.isPingSupported()) {
|
545
|
|
- this.connection.ping
|
|
536
|
+ this.connection.ping
|
546
|
537
|
.ping(this.connection.domain, resolve, reject, timeout);
|
547
|
|
- } else {
|
548
|
|
- reject('PING operation is not supported by the server');
|
549
|
|
- }
|
550
|
538
|
});
|
551
|
539
|
}
|
552
|
540
|
|