Hi, I am trying to connect my tables rows with realtime on my react website, it connects, but I dont get the rows when a row is being created. I tried with Channels etc, but nothing seems to work.
2 common issues:
- make sure you're using matching terminology to the one you use in your API (documents vs rows)
- make sure your listening user have permissions to see the rows/documents that fire the events
I also have a android app in production with realtime active and it was working before but now it doesnt for the past 2 days when checked it out.
Even my webapp in production is failing as well
Can you share any error messages if coming?
I tested with my projects, I am able to connect and receive messages as well
I guess you are getting some error messages as well can you share them along with your projectid
okay cool
It shows the error and just loops contantly,
It keeps reconnecting constantly, but I never recieve anything when a database change is made
headers
check here whats in the messages tab
it seems to be empty
Feeling like it's not even hitting the realtime service 🤔
Can you check whether locally things working or not ?
Whether you are able to hit the realtime service or not
I was before and everything was working fine
with realtime perfect
can I share a code sample
But Calling the Api and getting initial data before firing up the realtime everything is working but the only issue comes from the realtime.
This is the setup 'import { defineStore } from 'pinia'
export const useRealtime = defineStore('realtime', { state: () => ({ subscription: null, started: false }),
actions: {
async startWatch() {
if (this.started) return
const { realTime, Query } = useAppwrite()
const forNotifications = useNotifications()
// more stores here...
const forUserCreds = useUserCreds()
const forUserCredsId = computed(() => forUserCreds.mdV4UserId)
const config = useRuntimeConfig().public
const channels = [
`databases.${config.APPWRITE_DB_ID}.tables.${config.APPWRITE_USERNOTIFICATIONS_COLL}.rows`,
// more channels here...
]
this.subscription = await realTime.subscribe(channels, (res) => {
const row = res.payload
if (!row) return
const id = row.$id
const eventsVals = Object.values(res.events)
// NOTIFICATIONS
if (forNotifications.handles(row)) {
forNotifications.applyRealtime(id, row, eventsVals)
}
// more handlers here...
}, [
Query.or([
Query.equal('userId', forUserCredsId.value),
Query.equal('$id', forUserCredsId.value)
])
])
this.started = true
},
endWatch() {
if (this.subscription) this.subscription.close()
this.subscription = null
this.started = false
}
}
})'
i think your using wrong channels : https://appwrite.io/docs/apis/realtime/channels
your showing databases but it's tablesdb
it's possible that appwrite realtime force disconnect you if no channels match or if your using non-existing ones
Could be but the thing is, all this was working perfectly until a few days ago but let me check the docs. Thank you
i switched from databases to tablesdb but still
is this what you meant tablesdb.${config.APPWRITE_DB_ID}.tables.${config.APPWRITE_USERNOTIFICATIONS_COLL}.rows
Recommended threads
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...