Realtime
Plugin for interacting with the supabase realtime api
To use it you need to install it to the SupabaseClient:
val supabase = createSupabaseClient(supabaseUrl, supabaseKey) {
install(Realtime)
}
You can then create a channel:
val channel = supabase.realtime.channel("channelId")
Then listen to events on the channel:
val productChangeFlow = channel.postgrestChangeFlow<PostgrestAction.Insert>(schema = "public") {
table = "products"
}.map { it.decodeRecord<Product>() }
And at last you have to subscribe to the channel:
channel.subscribe()
Types
The current status of the realtime connection
Properties
Functions
Adds a channel to the subscriptions without subscribing to it.
Creates a new RealtimeChannel and adds it to the subscriptions
Creates a new RealtimeChannel and adds it to the Realtime.subscriptions
Connects to the realtime websocket. The url will be taken from the custom provided Realtime.Config.customUrl or SupabaseClient
Disconnects from the realtime websocket
Unsubscribes and removes all channels from the subscriptions
Unsubscribes and removes a channel from the subscriptions
Sends a message to the realtime websocket