diff --git a/packages/supabase/lib/src/realtime_client_options.dart b/packages/supabase/lib/src/realtime_client_options.dart deleted file mode 100644 index 2c1ffb39..00000000 --- a/packages/supabase/lib/src/realtime_client_options.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:realtime_client/realtime_client.dart'; - -/// {@template realtime_client_options} -/// Options to pass to the RealtimeClient. -/// {@endtemplate} -class RealtimeClientOptions { - /// How many events the RealtimeClient can push in a second - /// - /// Defaults to 10 events per second - @Deprecated( - 'Client side rate limit has been removed. This option will be ignored.') - final int? eventsPerSecond; - - /// Level of realtime server logs to be logged - final RealtimeLogLevel? logLevel; - - /// the timeout to trigger push timeouts - final Duration? timeout; - - /// {@macro realtime_client_options} - const RealtimeClientOptions({ - this.eventsPerSecond, - this.logLevel, - this.timeout, - }); -} diff --git a/packages/supabase/lib/src/supabase_client.dart b/packages/supabase/lib/src/supabase_client.dart index 382569f8..aa51c921 100644 --- a/packages/supabase/lib/src/supabase_client.dart +++ b/packages/supabase/lib/src/supabase_client.dart @@ -330,6 +330,7 @@ class SupabaseClient { 'apikey': _supabaseKey, }, headers: {'apikey': _supabaseKey, ...headers}, + transport: options.webSocketTransport, logLevel: options.logLevel, httpClient: _authHttpClient, timeout: options.timeout ?? RealtimeConstants.defaultTimeout, diff --git a/packages/supabase/lib/src/supabase_client_options.dart b/packages/supabase/lib/src/supabase_client_options.dart index 3587e618..af24c51d 100644 --- a/packages/supabase/lib/src/supabase_client_options.dart +++ b/packages/supabase/lib/src/supabase_client_options.dart @@ -23,3 +23,47 @@ class StorageClientOptions { const StorageClientOptions({this.retryAttempts = 0}); } + +/// {@template realtime_client_options} +/// Options to pass to the RealtimeClient. +/// {@endtemplate} +class RealtimeClientOptions { + /// How many events the RealtimeClient can push in a second + /// + /// Defaults to 10 events per second + @Deprecated( + 'Client side rate limit has been removed. This option will be ignored.') + final int? eventsPerSecond; + + /// Level of realtime server logs to be logged + final RealtimeLogLevel? logLevel; + + /// the timeout to trigger push timeouts + final Duration? timeout; + + /// The WebSocket implementation to use + final WebSocketTransport? webSocketTransport; + + /// {@macro realtime_client_options} + const RealtimeClientOptions({ + this.eventsPerSecond, + this.logLevel, + this.timeout, + this.webSocketTransport, + }); + + RealtimeClientOptions copyWith({ + int? eventsPerSecond, + RealtimeLogLevel? logLevel, + Duration? timeout, + WebSocketTransport? webSocketTransport, + }) { + return RealtimeClientOptions( + // ignore: deprecated_member_use_from_same_package + eventsPerSecond: eventsPerSecond ?? this.eventsPerSecond, + logLevel: logLevel ?? this.logLevel, + timeout: timeout ?? this.timeout, + webSocketTransport: webSocketTransport ?? this.webSocketTransport, + ); + } +} diff --git a/packages/supabase/lib/supabase.dart b/packages/supabase/lib/supabase.dart index dc899cea..176b244e 100644 --- a/packages/supabase/lib/supabase.dart +++ b/packages/supabase/lib/supabase.dart @@ -11,7 +11,6 @@ export 'package:realtime_client/realtime_client.dart'; export 'package:storage_client/storage_client.dart'; export 'src/auth_user.dart'; -export 'src/realtime_client_options.dart'; export 'src/remove_subscription_result.dart'; export 'src/supabase_client.dart'; export 'src/supabase_client_options.dart';