
Hello! I tried to use Realtime Subscription to receive User Document's updates, but in examples at the Appwrite Docs don't found correctly example to my Java. Briefly, I need to receive when User Document's updates and check "chats" (List<String>) parameter. If this changed, make a notification. Is it possible to receive this directly in Realtime Object? How to subscribe Realtime Channel/Channels?

Yes this is possible. What do you have now and what's wrong?

i don't know how to use RealtimeResponseListener (syntacsys)

and what usually means Object in that case

What's your code?

something like this ```String[] channels = new String[0]; realtime.subscribe(channels, new RealtimeResponseEvent<>((result21, error21) -> { if (error21 != null) { error21.printStackTrace(); return; }
Log.d("Appwrite", result21.toString());
}));```

So you'll need to specify the channels, but besides that, what's wrong?

when i typing result21 as object, it means <lambda parameter>? i don't understand it in that case

So you're getting a build error?

this also, error21.printStackTrace() and result21.toString()

Would you please share the exact error?

But when I do other functions, I receive io.appwrite.models, in example io.appwrite.models.Account and i getting parameters from this. Is this analogue like io.appwrite.models as result21?

cannot resolve method in both cases

Possibly...please share the full exact error

I solved this, but I had some questions. Is the realtime subscription returns payload and what can I do with that? What kind of data I can receive from payload?

Payload would match the event. For example, if you're subscribed to documents, the payload will be a document

I can cast it to Appwrite Document if subscribe in Document Updates? If I subscribe to Appwrite Collection Changes?

i rewrited code as ```RealtimeSubscription realtimeSubscription = realtime.subscribe(channelsArray, new RealtimeResponseEvent<>((events, channels, eventTimestamp, eventPayload) -> {
}));``` and receiving Multiple non-overriding abstract methods found in interface java.util.Collection error.

Yes, you can't change the parameters

Realtime response event is a generic...is that what's it's called in Java? You can pass a type to indicate what the type of the payload is. See https://github.com/appwrite/sdk-for-android/blob/c5974e005753b963bfc18d09c7f56bea97e2173c/library/src/main/java/io/appwrite/models/RealtimeModels.kt#L23
Recommended threads
- android kotlin error updatePhone
package vasu.apps.schooldashboard.Services import android.util.Log import io.appwrite.Client import io.appwrite.ID import io.appwrite.exceptions.AppwriteExcept...
- realtime failing
Hi everyone! I'm running into a weird issue with Appwrite realtime in my chat app and was hoping someone might have some insights. I have a chat view, and whe...
- Google OAuth2 screen loop issue in Flut...
i am trying to authenticate user on my app using google, everything works fine, but even after succesfull authentication instead of redirecting back to the app,...
