@@ -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
*/
@@ -1285,6 +1285,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1285
1285
protected txnCtr = 0 ;
1286
1286
protected mediaHandler = new MediaHandler ( this ) ;
1287
1287
protected sessionId : string ;
1288
+ protected delayedEventRestartLocalTimeoutMS : number | undefined ;
1288
1289
1289
1290
/** IDs of events which are currently being encrypted.
1290
1291
*
@@ -1327,7 +1328,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
1327
1328
1328
1329
const userId = opts . userId || null ;
1329
1330
this . credentials = { userId } ;
1330
-
1331
+ this . delayedEventRestartLocalTimeoutMS = opts . delayedEventRestartLocalTimeoutMS ;
1331
1332
this . http = new MatrixHttpApi ( this as ConstructorParameters < typeof MatrixHttpApi > [ 0 ] , {
1332
1333
fetchFn : opts . fetchFn ,
1333
1334
baseUrl : opts . baseUrl ,
@@ -3487,7 +3488,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
3487
3488
action,
3488
3489
} ;
3489
3490
const opts = {
3490
- localTimeoutMs : action === "restart" ? this . clientOpts ?. delayedEventRestartLocalTimeoutMS : undefined ,
3491
+ localTimeoutMs : action === "restart" ? this . delayedEventRestartLocalTimeoutMS : undefined ,
3491
3492
...requestOptions ,
3492
3493
} ;
3493
3494
return await this . http . authedRequest ( Method . Post , path , undefined , data , {
0 commit comments