File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
import 'dart:async' ;
2
2
import 'dart:convert' ;
3
3
4
+ import 'package:http/http.dart' ;
4
5
import 'package:meta/meta.dart' ;
5
6
import 'package:realtime_client/realtime_client.dart' ;
6
7
import 'package:realtime_client/src/constants.dart' ;
@@ -427,7 +428,7 @@ class RealtimeChannel {
427
428
]
428
429
};
429
430
try {
430
- final res = await socket.httpClient.post (
431
+ final res = await ( socket.httpClient? .post ?? post) (
431
432
Uri .parse (broadcastEndpointURL),
432
433
headers: headers,
433
434
body: json.encode (body),
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class RealtimeClient {
55
55
final Map <String , dynamic > params;
56
56
final Duration timeout;
57
57
final WebSocketTransport transport;
58
- final Client httpClient;
58
+ final Client ? httpClient;
59
59
int heartbeatIntervalMs = 30000 ;
60
60
Timer ? heartbeatTimer;
61
61
@@ -110,7 +110,7 @@ class RealtimeClient {
110
110
this .params = const {},
111
111
this .longpollerTimeout = 20000 ,
112
112
RealtimeLogLevel ? logLevel,
113
- Client ? httpClient,
113
+ this . httpClient,
114
114
}) : endPoint = Uri .parse ('$endPoint /${Transports .websocket }' )
115
115
.replace (
116
116
queryParameters:
@@ -121,8 +121,7 @@ class RealtimeClient {
121
121
...Constants .defaultHeaders,
122
122
if (headers != null ) ...headers,
123
123
},
124
- transport = transport ?? createWebSocketClient,
125
- httpClient = httpClient ?? Client () {
124
+ transport = transport ?? createWebSocketClient {
126
125
final eventsPerSecond = params['eventsPerSecond' ];
127
126
if (eventsPerSecond != null ) {
128
127
eventsPerSecondLimitMs = (1000 / int .parse (eventsPerSecond)).floor ();
Original file line number Diff line number Diff line change @@ -279,6 +279,7 @@ class SupabaseClient {
279
279
},
280
280
headers: headers,
281
281
logLevel: options.logLevel,
282
+ httpClient: _authHttpClient,
282
283
);
283
284
}
284
285
You can’t perform that action at this time.
0 commit comments