Skip to content

Commit 65d8b56

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

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ class SupabaseClient {
263263
headers: {'apikey': _supabaseKey, ...headers},
264264
logLevel: options.logLevel,
265265
httpClient: _authHttpClient,
266+
timeout: options.timeout ?? RealtimeConstants.defaultTimeout,
266267
);
267268
}
268269

0 commit comments

Comments
 (0)