Skip to main content

subscribe()

Subscribe to realtime changes in your service.

kontenbase.realtime.subscribe('posts', { event: '*' }, (message) => {
if (message.error) {
console.log(message.error)
return
}

console.log(message.event, message.payload)
})

Parameters

NameTypeRequiredDescription
serviceNamestringtrueThe service name to be subscribed
conditionobjecttrueCondition consists of event and where
condition.eventstringtrueThe event can be *, CREATE_RECORD, UPDATE_RECORD. DELETE_RECORD
condition.whereobjectfalseRefering to filters docs