@@ -4,7 +4,7 @@ import { SupabaseAuthClient } from './lib/SupabaseAuthClient'
4
4
import { SupabaseQueryBuilder } from './lib/SupabaseQueryBuilder'
5
5
import { SupabaseStorageClient } from '@supabase/storage-js'
6
6
import { PostgrestClient } from '@supabase/postgrest-js'
7
- import { RealtimeClient , RealtimeSubscription } from '@supabase/realtime-js'
7
+ import { RealtimeClient , RealtimeSubscription , RealtimeClientOptions } from '@supabase/realtime-js'
8
8
9
9
const DEFAULT_OPTIONS = {
10
10
schema : 'public' ,
@@ -42,6 +42,7 @@ export default class SupabaseClient {
42
42
* @param options.persistSession Set to "true" if you want to automatically save the user session into local storage.
43
43
* @param options.detectSessionInUrl Set to "true" if you want to automatically detects OAuth grants in the URL and signs in the user.
44
44
* @param options.headers Any additional headers to send with each network request.
45
+ * @param options.realtime Options passed along to realtime-js constructor.
45
46
*/
46
47
constructor (
47
48
protected supabaseUrl : string ,
@@ -59,7 +60,7 @@ export default class SupabaseClient {
59
60
this . schema = settings . schema
60
61
61
62
this . auth = this . _initSupabaseAuthClient ( settings )
62
- this . realtime = this . _initRealtimeClient ( )
63
+ this . realtime = this . _initRealtimeClient ( settings . realtime )
63
64
64
65
// In the future we might allow the user to pass in a logger to receive these events.
65
66
// this.realtime.onOpen(() => console.log('OPEN'))
@@ -154,9 +155,10 @@ export default class SupabaseClient {
154
155
} )
155
156
}
156
157
157
- private _initRealtimeClient ( ) {
158
+ private _initRealtimeClient ( options ?: RealtimeClientOptions ) {
158
159
return new RealtimeClient ( this . realtimeUrl , {
159
- params : { apikey : this . supabaseKey } ,
160
+ ...options ,
161
+ params : { ...options ?. params , apikey : this . supabaseKey } ,
160
162
} )
161
163
}
162
164
0 commit comments