BlueForge Docs

client.channel

Subscribe to realtime changes on a table

Signature

class Client {
  channel<T>(table: string): RealtimeChannel
}

Parameters

ParamTypeRequiredDescription
table
string
yesTable name to subscribe to

Examples

import { Client } from '@blueforge/client'
const bf = new Client({ apiKey: process.env.BF_API_KEY!, url: 'https://your-project.blueforge.dev' })

const channel = bf.channel('users')
channel.on('INSERT', (payload) => console.log('new user:', payload.new))
channel.subscribe()

Throws

ErrorCondition
ApiError
API request failed
NetworkError
Network issue

Pitfalls

Real-time requires the table to have realtime enabled via

POST /v1/realtime/enable
.

See also

{auto-injected}

Tested against

{auto-injected}