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