@@ -7,12 +7,7 @@ import { SupabaseStorageClient } from '@supabase/storage-js'
7
7
import { FunctionsClient } from '@supabase/functions-js'
8
8
import { PostgrestClient } from '@supabase/postgrest-js'
9
9
import { AuthChangeEvent } from '@supabase/gotrue-js'
10
- import {
11
- RealtimeClient ,
12
- RealtimeSubscription ,
13
- RealtimeClientOptions ,
14
- RealtimeChannel ,
15
- } from '@supabase/realtime-js'
10
+ import { RealtimeClient , RealtimeSubscription , RealtimeClientOptions } from '@supabase/realtime-js'
16
11
17
12
const DEFAULT_OPTIONS = {
18
13
schema : 'public' ,
@@ -160,20 +155,6 @@ export default class SupabaseClient {
160
155
return rest . rpc < T > ( fn , params , { head, count } )
161
156
}
162
157
163
- /**
164
- * Creates a channel with Broadcast and Presence.
165
- * Activated when vsndate query param is present in the WebSocket URL.
166
- */
167
- channel ( name : string , opts : { selfBroadcast : boolean ; [ key : string ] : any } ) : RealtimeChannel {
168
- const userToken = this . auth . session ( ) ?. access_token ?? this . supabaseKey
169
-
170
- if ( ! this . realtime . isConnected ( ) ) {
171
- this . realtime . connect ( )
172
- }
173
-
174
- return this . realtime . channel ( name , { ...opts , user_token : userToken } ) as RealtimeChannel
175
- }
176
-
177
158
/**
178
159
* Closes and removes all subscriptions and returns a list of removed
179
160
* subscriptions and their errors.
@@ -193,23 +174,6 @@ export default class SupabaseClient {
193
174
} )
194
175
}
195
176
196
- /**
197
- * Closes and removes a channel and returns the number of open channels.
198
- *
199
- * @param channel The channel you want to close and remove.
200
- */
201
- async removeChannel (
202
- channel : RealtimeChannel
203
- ) : Promise < { data : { openChannels : number } ; error : Error | null } > {
204
- const { error } = await this . _closeSubscription ( channel )
205
- const allChans : RealtimeSubscription [ ] = this . getSubscriptions ( )
206
- const openChanCount = allChans . filter ( ( chan ) => chan . isJoined ( ) ) . length
207
-
208
- if ( allChans . length === 0 ) await this . realtime . disconnect ( )
209
-
210
- return { data : { openChannels : openChanCount } , error }
211
- }
212
-
213
177
/**
214
178
* Closes and removes a subscription and returns the number of open subscriptions.
215
179
*
@@ -228,7 +192,7 @@ export default class SupabaseClient {
228
192
}
229
193
230
194
private async _closeSubscription (
231
- subscription : RealtimeSubscription | RealtimeChannel
195
+ subscription : RealtimeSubscription
232
196
) : Promise < { error : Error | null } > {
233
197
let error = null
234
198
@@ -243,7 +207,7 @@ export default class SupabaseClient {
243
207
}
244
208
245
209
private _unsubscribeSubscription (
246
- subscription : RealtimeSubscription | RealtimeChannel
210
+ subscription : RealtimeSubscription
247
211
) : Promise < { error : Error | null } > {
248
212
return new Promise ( ( resolve ) => {
249
213
subscription
0 commit comments