@@ -340,6 +340,19 @@ export interface ICreateClientOpts {
340
340
*/
341
341
localTimeoutMs ?: number ;
342
342
343
+ /**
344
+ * The maximum amount of time to wait before timing out the `POST /_matrix/client/v1/delayed_events/{delay_id}` with `action = "restart"` requests.
345
+ * If not specified, it uses `localTimeoutMs` if set, otherwise there is no timeout.
346
+ *
347
+ * This setting is used in the context of MatrixRTC. We need to restart the dealyed events to make sure
348
+ * the HomeServer is sending the delayed rtc leave event. In bad network environments we might end up
349
+ * waiting for too long for the event to arrive and we will not send another restart event until the local timeout is reached.
350
+ *
351
+ * In those scenarios chances for success are higher if we use a lower local timeout to increase the tries we do instead of waiting
352
+ * for responses on requests which are stuck.
353
+ */
354
+ delayedEventRestartLocalTimeoutMS ?: number ;
355
+
343
356
/**
344
357
* Set to false to send the access token to the server via a query parameter rather
345
358
* than the Authorization HTTP header.
@@ -493,19 +506,6 @@ export interface IStartClientOpts {
493
506
*/
494
507
pollTimeout ?: number ;
495
508
496
- /**
497
- * The maximum amount of time to wait before timing out the `POST /_matrix/client/v1/delayed_events/{delay_id}` with `action = "restart"` requests.
498
- * If not specified, the default `localTimeoutMs` will be used.
499
- *
500
- * This setting is used in the context of MatrixRTC. We need to restart the dealyed events to make sure
501
- * the HomeServer is sending the delayed rtc leave event. In bad network environments we might end up
502
- * waiting for too long for the event to arrive and we will not send another restart event until the local timeout is reached.
503
- *
504
- * In those scenarios chances for success are higher if we use a lower local timeout to increase the tries we do instead of waiting
505
- * for responses on requests which are stuck.
506
- */
507
- delayedEventRestartLocalTimeoutMS ?: number ;
508
-
509
509
/**
510
510
* The filter to apply to /sync calls.
511
511
*/
@@ -1282,6 +1282,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1282
1282
protected txnCtr = 0 ;
1283
1283
protected mediaHandler = new MediaHandler ( this ) ;
1284
1284
protected sessionId : string ;
1285
+ protected delayedEventRestartLocalTimeoutMS : number | undefined ;
1285
1286
1286
1287
/** IDs of events which are currently being encrypted.
1287
1288
*
@@ -1324,7 +1325,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1324
1325
1325
1326
const userId = opts . userId || null ;
1326
1327
this . credentials = { userId } ;
1327
-
1328
+ this . delayedEventRestartLocalTimeoutMS = opts . delayedEventRestartLocalTimeoutMS ;
1328
1329
this . http = new MatrixHttpApi ( this as ConstructorParameters < typeof MatrixHttpApi > [ 0 ] , {
1329
1330
fetchFn : opts . fetchFn ,
1330
1331
baseUrl : opts . baseUrl ,
@@ -3492,7 +3493,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
3492
3493
action,
3493
3494
} ;
3494
3495
const opts = {
3495
- localTimeoutMs : action === "restart" ? this . clientOpts ?. delayedEventRestartLocalTimeoutMS : undefined ,
3496
+ localTimeoutMs : action === "restart" ? this . delayedEventRestartLocalTimeoutMS : undefined ,
3496
3497
...requestOptions ,
3497
3498
} ;
3498
3499
return await this . http . authedRequest ( Method . Post , path , undefined , data , {
0 commit comments