Skip to content

Commit a6180b5

Browse files
johnnns52k
john
authored andcommitted
supabase: Allow setting timeout of RealtimeClient.
1 parent 408e816 commit a6180b5

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

packages/realtime_client/lib/realtime_client.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export 'src/constants.dart' show RealtimeLogLevel;
1+
export 'src/constants.dart' show RealtimeConstants, RealtimeLogLevel;
22
export 'src/realtime_channel.dart';
33
export 'src/realtime_client.dart';
44
export 'src/realtime_presence.dart';

packages/realtime_client/lib/src/constants.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class Constants {
99
};
1010
}
1111

12+
typedef RealtimeConstants = Constants;
13+
1214
enum SocketStates {
1315
/// Client attempting to establish a connection
1416
connecting,

packages/supabase/lib/src/realtime_client_options.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ class RealtimeClientOptions {
1414
/// Level of realtime server logs to to be logged
1515
final RealtimeLogLevel? logLevel;
1616

17+
/// the timeout to trigger push timeouts
18+
final Duration? timeout;
19+
1720
/// {@macro realtime_client_options}
1821
const RealtimeClientOptions({
1922
this.eventsPerSecond,
2023
this.logLevel,
24+
this.timeout,
2125
});
2226
}

packages/supabase/lib/src/supabase_client.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:http/http.dart';
44
import 'package:supabase/src/constants.dart';
55
import 'package:supabase/supabase.dart';
66
import 'package:yet_another_json_isolate/yet_another_json_isolate.dart';
7+
import 'package:realtime_client/realtime_client.dart';
78

89
import 'auth_http_client.dart';
910
import 'counter.dart';
@@ -263,6 +264,7 @@ class SupabaseClient {
263264
headers: {'apikey': _supabaseKey, ...headers},
264265
logLevel: options.logLevel,
265266
httpClient: _authHttpClient,
267+
timeout: options.timeout ?? RealtimeConstants.defaultTimeout,
266268
);
267269
}
268270

0 commit comments

Comments
 (0)