Package-level declarations

Types

Link copied to clipboard
@Serializable
data class BroadcastJoinConfig(var acknowledgeBroadcasts: Boolean, var receiveOwnBroadcasts: Boolean)
Link copied to clipboard
sealed interface CallbackManager
Link copied to clipboard
@Serializable
data class Column(val name: String, val type: String)

Contains information about a column

Link copied to clipboard

Represents a postgres action, containing an old record.

Link copied to clipboard

Represents a postgres action, containing a record.

Link copied to clipboard
sealed interface PostgresAction : SerializableData

Represents a postgres action

Link copied to clipboard
class PostgresChangeFilter(event: String, schema: String)

Used to filter postgres changes

Link copied to clipboard
@Serializable
data class PostgresJoinConfig(val schema: String, val table: String? = null, val filter: String? = null, val event: String, val id: Long = 0)
Link copied to clipboard
@Serializable(with = Presence.Companion::class)
data class Presence(val presenceRef: String, val state: JsonObject)
Link copied to clipboard
sealed interface PresenceAction

Represents a presence action

Link copied to clipboard
@Serializable
data class PresenceJoinConfig(var key: String)
Link copied to clipboard
data class PrimaryKey<Data>(val columnName: String, val producer: (Data) -> String)

Represents the primary key of the Data type.

Link copied to clipboard

Plugin for interacting with the supabase realtime api

Link copied to clipboard
sealed interface RealtimeCallback<T>
Link copied to clipboard
sealed interface RealtimeChannel

Represents a realtime channel

Link copied to clipboard

Used to build a realtime channel

Link copied to clipboard
@Serializable
data class RealtimeJoinConfig(val broadcast: BroadcastJoinConfig, val presence: PresenceJoinConfig, val postgresChanges: List<PostgresJoinConfig>, var isPrivate: Boolean)
Link copied to clipboard
@Serializable
data class RealtimeJoinPayload(val config: RealtimeJoinConfig)
Link copied to clipboard
@Serializable
data class RealtimeMessage(val topic: String, val event: String, val payload: JsonObject, val ref: String?)

Represents a message retrieved by the RealtimeChannel

Properties

Link copied to clipboard

Supabase Realtime is a way to listen to changes in the PostgreSQL database via websockets

Functions

Link copied to clipboard
inline suspend fun <T : Any> RealtimeChannel.broadcast(event: String, message: T)

Sends a message to everyone who joined the channel. Can be used even if you aren't connected to the channel.

Link copied to clipboard
inline fun <T : Any> RealtimeChannel.broadcastFlow(event: String): Flow<T>

Broadcasts can be messages sent by other clients within the same channel under a specific event.

Link copied to clipboard
inline fun SupabaseClient.channel(channelId: String, builder: RealtimeChannelBuilder.() -> Unit = {}): RealtimeChannel
inline fun Realtime.channel(channelId: String, builder: RealtimeChannelBuilder.() -> Unit = {}): RealtimeChannel

Creates a new RealtimeChannel

Link copied to clipboard
inline fun <T> PresenceAction.decodeJoinsAs(ignoreOtherTypes: Boolean = true): List<T>

Decodes all PresenceAction.joins values as T

Link copied to clipboard
inline fun <T> PresenceAction.decodeLeavesAs(ignoreOtherTypes: Boolean = true): List<T>

Decodes all PresenceAction.leaves values as T

Link copied to clipboard
inline fun <T : Any> HasOldRecord.decodeOldRecord(): T

Decodes HasOldRecord.oldRecord as T and returns it

Link copied to clipboard

Decodes HasOldRecord.oldRecord as T and returns it or returns null when it cannot be decoded as T

Link copied to clipboard
inline fun <T : Any> HasRecord.decodeRecord(): T

Decodes HasRecord.record as T and returns it

Link copied to clipboard
inline fun <T : Any> HasRecord.decodeRecordOrNull(): T?

Decodes HasRecord.record as T and returns it or returns null when it cannot be decoded as T

Link copied to clipboard
inline fun <T : PostgresAction> RealtimeChannel.postgresChangeFlow(schema: String, noinline filter: PostgresChangeFilter.() -> Unit = {}): Flow<T>

Listen for postgres changes in a channel.

Link copied to clipboard
inline fun <Data : Any> RealtimeChannel.postgresListDataFlow(schema: String = "public", table: String, filter: FilterOperation? = null, primaryKey: PrimaryKey<Data>): Flow<List<Data>>
inline fun <Data : Any> RealtimeChannel.postgresListDataFlow(schema: String = "public", table: String, filter: FilterOperation? = null, primaryKeys: List<PrimaryKey<Data>>): Flow<List<Data>>
@JvmName(name = "postgresListDataFlowMultiplePks")
inline fun <Data : Any, Value> RealtimeChannel.postgresListDataFlow(schema: String = "public", table: String, filter: FilterOperation? = null, primaryKeys: List<KProperty1<Data, Value>>): Flow<List<Data>>
inline fun <Data : Any, Value> RealtimeChannel.postgresListDataFlow(schema: String = "public", table: String, filter: FilterOperation? = null, primaryKey: KProperty1<Data, Value>): Flow<List<Data>>

This function retrieves the initial data from the table and then listens for changes. It automatically handles inserts, updates and deletes.

Link copied to clipboard
inline suspend fun <Data : Any> RealtimeChannel.postgresSingleDataFlow(schema: String = "public", table: String, primaryKey: PrimaryKey<Data>, crossinline filter: PostgrestFilterBuilder.() -> Unit): Flow<Data>
inline suspend fun <Data, Value> RealtimeChannel.postgresSingleDataFlow(schema: String = "public", table: String, primaryKey: KProperty1<Data, Value>, crossinline filter: PostgrestFilterBuilder.() -> Unit): Flow<Data>

This function retrieves the initial data for a single value and then listens for changes on that value. It automatically handles updates and closes the flow on the delete event.

Link copied to clipboard

Listens for presence changes and caches the presences based on their keys. This function automatically handles joins and leaves.

Link copied to clipboard
inline fun <Data : Any> PostgrestQueryBuilder.selectAsFlow(primaryKey: PrimaryKey<Data>, channelName: String? = null, filter: FilterOperation? = null): Flow<List<Data>>
inline fun <Data : Any> PostgrestQueryBuilder.selectAsFlow(primaryKeys: List<PrimaryKey<Data>>, channelName: String? = null, filter: FilterOperation? = null): Flow<List<Data>>
@JvmName(name = "selectAsFlowMultiplePks")
inline fun <Data : Any, Value> PostgrestQueryBuilder.selectAsFlow(primaryKeys: List<KProperty1<Data, Value>>, channelName: String? = null, filter: FilterOperation? = null): Flow<List<Data>>
inline fun <Data : Any, Value> PostgrestQueryBuilder.selectAsFlow(primaryKey: KProperty1<Data, Value>, channelName: String? = null, filter: FilterOperation? = null): Flow<List<Data>>

Executes vertical filtering with select on PostgrestQueryBuilder.table and PostgrestQueryBuilder.schema and returns a Flow of a list of values matching the filter. This function listens for changes in the table and emits the new list whenever a change occurs.

Link copied to clipboard
inline fun <Data : Any> PostgrestQueryBuilder.selectSingleValueAsFlow(primaryKey: PrimaryKey<Data>, channelName: String? = null, crossinline filter: PostgrestFilterBuilder.() -> Unit): Flow<Data>
inline fun <Data : Any, Value> PostgrestQueryBuilder.selectSingleValueAsFlow(primaryKey: KProperty1<Data, Value>, channelName: String? = null, crossinline filter: PostgrestFilterBuilder.() -> Unit): Flow<Data>

Executes vertical filtering with select on PostgrestQueryBuilder.table and PostgrestQueryBuilder.schema and returns a Flow of a single value matching the filter. This function listens for changes in the table and emits the new value whenever a change occurs.

Link copied to clipboard
inline suspend fun <T : Any> RealtimeChannel.track(state: T)

Store an object in your presence's state. Other clients can get this data when you either join or leave the channel. Use this method again to update the state.