Skip to content

FluxbaseAdminRealtime

Realtime Admin Manager

Provides methods for enabling and managing realtime subscriptions on database tables. When enabled, changes to a table (INSERT, UPDATE, DELETE) are automatically broadcast to WebSocket subscribers.

const realtime = client.admin.realtime
// Enable realtime on a table
await realtime.enableRealtime('products')
// Enable with options
await realtime.enableRealtime('orders', {
events: ['INSERT', 'UPDATE'],
exclude: ['internal_notes', 'raw_data']
})
// List all realtime-enabled tables
const { tables } = await realtime.listTables()
// Check status of a specific table
const status = await realtime.getStatus('public', 'products')
// Disable realtime
await realtime.disableRealtime('public', 'products')

new FluxbaseAdminRealtime(fetch): FluxbaseAdminRealtime

ParameterType
fetchFluxbaseFetch

FluxbaseAdminRealtime

disableRealtime(schema, table): Promise<object>

Disable realtime on a table

Removes the realtime trigger from a table. Existing subscribers will stop receiving updates for this table.

ParameterTypeDescription
schemastringSchema name
tablestringTable name

Promise<object>

Promise resolving to success message

NameType
messagestring
successboolean
await client.admin.realtime.disableRealtime('public', 'products')
console.log('Realtime disabled')

enableRealtime(table, options?): Promise<EnableRealtimeResponse>

Enable realtime on a table

Creates the necessary database triggers to broadcast changes to WebSocket subscribers. Also sets REPLICA IDENTITY FULL to include old values in UPDATE/DELETE events.

ParameterTypeDescription
tablestringTable name to enable realtime on
options?objectOptional configuration
options.events?("DELETE" | "INSERT" | "UPDATE")[]-
options.exclude?string[]-
options.schema?string-

Promise<EnableRealtimeResponse>

Promise resolving to EnableRealtimeResponse

// Enable realtime on products table (all events)
await client.admin.realtime.enableRealtime('products')
// Enable on a specific schema
await client.admin.realtime.enableRealtime('orders', {
schema: 'sales'
})
// Enable specific events only
await client.admin.realtime.enableRealtime('audit_log', {
events: ['INSERT'] // Only broadcast inserts
})
// Exclude large columns from notifications
await client.admin.realtime.enableRealtime('posts', {
exclude: ['content', 'raw_html'] // Skip these in payload
})

getStatus(schema, table): Promise<RealtimeTableStatus>

Get realtime status for a specific table

Returns the realtime configuration for a table, including whether it’s enabled, which events are tracked, and which columns are excluded.

ParameterTypeDescription
schemastringSchema name
tablestringTable name

Promise<RealtimeTableStatus>

Promise resolving to RealtimeTableStatus

const status = await client.admin.realtime.getStatus('public', 'products')
if (status.realtime_enabled) {
console.log('Events:', status.events.join(', '))
console.log('Excluded:', status.excluded_columns?.join(', ') || 'none')
} else {
console.log('Realtime not enabled')
}

listTables(options?): Promise<ListRealtimeTablesResponse>

List all realtime-enabled tables

Returns a list of all tables that have realtime enabled, along with their configuration (events, excluded columns, etc.).

ParameterTypeDescription
options?objectOptional filter options
options.includeDisabled?boolean-

Promise<ListRealtimeTablesResponse>

Promise resolving to ListRealtimeTablesResponse

// List all enabled tables
const { tables, count } = await client.admin.realtime.listTables()
console.log(`${count} tables have realtime enabled`)
tables.forEach(t => {
console.log(`${t.schema}.${t.table}: ${t.events.join(', ')}`)
})
// Include disabled tables
const all = await client.admin.realtime.listTables({ includeDisabled: true })

updateConfig(schema, table, config): Promise<object>

Update realtime configuration for a table

Modifies the events or excluded columns for a realtime-enabled table without recreating the trigger.

ParameterTypeDescription
schemastringSchema name
tablestringTable name
configUpdateRealtimeConfigRequestNew configuration

Promise<object>

Promise resolving to success message

NameType
messagestring
successboolean
// Change which events are tracked
await client.admin.realtime.updateConfig('public', 'products', {
events: ['INSERT', 'UPDATE'] // Stop tracking deletes
})
// Update excluded columns
await client.admin.realtime.updateConfig('public', 'posts', {
exclude: ['raw_content', 'search_vector']
})
// Clear excluded columns
await client.admin.realtime.updateConfig('public', 'posts', {
exclude: [] // Include all columns again
})