@@ -11,6 +11,8 @@ import 'package:supabase_flutter/src/flutter_go_true_client_options.dart';
11
11
import 'package:supabase_flutter/src/local_storage.dart' ;
12
12
import 'package:supabase_flutter/src/supabase_auth.dart' ;
13
13
14
+ import 'platform_http_io.dart'
15
+ if (dart.library.js_interop) 'platform_http_web.dart' ;
14
16
import 'version.dart' ;
15
17
16
18
final _log = Logger ('supabase.supabase_flutter' );
@@ -114,6 +116,13 @@ class Supabase with WidgetsBindingObserver {
114
116
),
115
117
);
116
118
}
119
+ if (realtimeClientOptions.webSocketTransport == null ) {
120
+ final platformWebSocketChannel = getPlatformWebSocketChannel (url);
121
+ if (platformWebSocketChannel != null ) {
122
+ realtimeClientOptions = realtimeClientOptions.copyWith (
123
+ webSocketTransport: (url, headers) => platformWebSocketChannel);
124
+ }
125
+ }
117
126
_instance._init (
118
127
url,
119
128
anonKey,
@@ -192,10 +201,16 @@ class Supabase with WidgetsBindingObserver {
192
201
...Constants .defaultHeaders,
193
202
if (customHeaders != null ) ...customHeaders
194
203
};
204
+ final Client platformHttpClient;
205
+ if (httpClient != null ) {
206
+ platformHttpClient = httpClient;
207
+ } else {
208
+ platformHttpClient = getPlatformHttpClient ();
209
+ }
195
210
client = SupabaseClient (
196
211
supabaseUrl,
197
212
supabaseAnonKey,
198
- httpClient: httpClient ,
213
+ httpClient: platformHttpClient ,
199
214
headers: headers,
200
215
realtimeClientOptions: realtimeClientOptions,
201
216
postgrestOptions: postgrestOptions,
0 commit comments